Public report of koharu-rs/koharu, 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 report Measured 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:57 UTC · Survey ID cd_da7da348bbee4ae8aa75264b95a8a2a9

koharu-rs/koharu

Measured 14 November 2026, 18:56 UTC, at code version 5ad1065

Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).

CAI score 62out of 100 At risk Up 3 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: 117,385 lines of product code in 27 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Accessibility, 57

Findings by how serious they are

54 critical 808 serious 53 minor

14 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

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 18:56 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

62of 62 dimensions measured by tools.
882of 915 findings point to an exact file and line, so you can open each one in the code. The other 33 concern the repository as a whole, such as missing documentation.
62dimensions across 8 lenses, read from 117,385 lines of product code in 27 projects.
Chapters

Executive summary

koharu-rs/koharu is rated At risk because critical security findings are open, most of them in the build pipeline. It scores 62 out of 100, which the At risk rating leaves unchanged. We judged it as a preview release, against a lower bar.

Accessibility, at 57, is the weakest lens and counts most in the score. The best first steps are making the controls keyboard-usable and stopping the 14 pipeline steps that hand secrets to unpinned tools, each worth about 3 points. Raising Accessibility to 65 would lift the score to about 64.

Twenty-nine pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Fourteen secrets can leak from the build pipeline, and seven known security holes in the packages the code depends on can be used by attackers. Pinning each tool to an exact version, limiting each secret to its own step and updating the vulnerable packages would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once. The page or frame without a title needs a descriptive title.

The product code is 117,385 lines, about €140,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 for The 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.
Accessibility 57 · counts for 45%Security and Compliance 58 · counts for 25%Code Health 69 · counts for 14%Maturity 69 · counts for 8%Production Readiness 78 · counts for 4%Performance 91 · counts for 2%Architecture 96 · counts for 1%Event Sourcing 100 · counts for 1%

If Accessibility rose from 57 to 65, the lowest score rated Strong, the score would rise from 62 to about 64.

Code composition: what the lines of code are
Product code 96%Tests 4%
New since the last survey: 279 findings

These 279 critical or serious findings weren't in the previous survey, on 28 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Code Duplication · Near-duplicate member pair (23 shared lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Edited copy of a member (10 corresponding lines) crates/koharu-torch/src/vision/efficientnet.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-scene/src/edit.rs
  • Code Duplication · Edited copy of a member (48 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copy of a member (55 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) crates/koharu-torch/src/vision/inception.rs
  • Code Duplication · Edited copy of a member (66 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (61 corresponding lines) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs
  • Code Duplication · Edited copy of a member (48 corresponding lines) crates/koharu-ml/src/pp_ocr_v6/det/processor.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (51 corresponding lines) crates/koharu-app/src/commands/import/rar.rs
  • Code Duplication · Edited copies of one member (3 members, 43+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) crates/koharu-ml/src/speech_bubble_yolo11n/model.rs
  • Code Duplication · Edited copy of a member (44 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) crates/koharu-canvas/src/web.rs
  • Code Duplication · Edited copy of a member (22 corresponding lines) crates/koharu-torch/src/vision/resnet.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (20 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Edited copy of a member (52 corresponding lines) crates/koharu-rasterizer/src/native.rs
  • Code Duplication · Edited copy of a member (33 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Edited copy of a member (18 corresponding lines) crates/koharu-torch/src/vision/inception.rs
  • Code Duplication · Edited copy of a member (27 corresponding lines) crates/koharu-scene/src/edit.rs
  • Code Duplication · Edited copy of a member (21 corresponding lines) crates/koharu-app/src/commands/lifecycle.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) crates/koharu-ml/src/baberu_ocr/model.rs
  • Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) crates/koharu-ml/src/bin/comic_text_detector.rs
  • Code Duplication · Edited copy of a member (22 corresponding lines) crates/koharu-renderer/src/renderer.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-torch/src/vision/resnet.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) crates/koharu-torch/src/wrappers/tensor.rs
  • Code Duplication · Edited copy of a member (20 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) crates/koharu-llama/src/context/session.rs
  • Code Duplication · Edited copies of one member (4 members, 30+ corresponding lines) crates/koharu-ml/src/paddle_ocr_vl/mod.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) crates/koharu-ml/src/bin/comic_text_bubble_detector.rs
  • Code Duplication · Edited copy of a member (30 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (20 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-ml/src/pp_ocr_v6/rec/model.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-llama/src/sampling.rs
  • Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) crates/koharu-app/src/commands/canvas.rs
  • Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/mod.rs
  • Code Duplication · Edited copy of a member (38 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs
  • Code Duplication · Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (24 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-torch/src/nn/rnn.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-torch/src/nn/sequential.rs
  • Code Duplication · Edited copy of a member (9 corresponding lines) crates/koharu-ml/src/pp_doclayout_v3/model.rs
  • Code Duplication · Edited copies of one member (4 members, 22+ corresponding lines) crates/koharu-translator/src/remote/deepseek.rs
  • Code Duplication · Edited copy of a member (32 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs
  • Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) crates/koharu-runtime/src/runtime/packages/cuda.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-llama/src/model.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) crates/koharu-llama/src/mtmd.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-app/src/commands/editing.rs
  • Code Duplication · Edited copy of a member (15 corresponding lines) crates/koharu-diffusion/src/image.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) crates/koharu-app/src/commands/project.rs
  • Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) crates/koharu-canvas/src/web.rs
  • Code Duplication · Edited copy of a member (12 corresponding lines) crates/koharu-ml/src/bin/aot_inpainting.rs
  • Code Duplication · Edited copy of a member (19 corresponding lines) crates/koharu-scene/src/schema.rs
  • Code Duplication · Edited copy of a member (15 corresponding lines) crates/koharu-app/src/commands/agent/host.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) crates/koharu-torch/src/nn/var_store.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copies of one member (8 members, 12+ corresponding lines) crates/koharu-app/src/commands/editing.rs
  • Code Duplication · Edited copy of a member (21 corresponding lines) crates/koharu-ml/src/baberu_ocr/model.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-scene/src/edit.rs
  • Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) crates/koharu-llama/src/context/session.rs
  • Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) crates/koharu-app/src/commands/editing.rs
  • Code Duplication · Edited copy of a member (12 corresponding lines) crates/koharu-app/src/commands/project.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) crates/koharu-torch/src/nn/var_store.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-pipeline/src/stages/inpainting.rs
  • Code Duplication · Edited copy of a member (15 corresponding lines) crates/koharu-torch/src/vision/inception.rs
  • Code Duplication · Edited copy of a member (10 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs
  • Code Duplication · Edited copy of a member (8 corresponding lines) crates/koharu-ml/src/comic_text_detector/model.rs
  • Code Duplication · Edited copy of a member (18 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) crates/koharu-ml/src/manga_ocr/model.rs
  • Code Duplication · Edited copy of a member (11 corresponding lines) crates/koharu-ml/src/pp_ocr_v6/det/model.rs
  • Code Duplication · Edited copy of a member (15 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/config.rs
  • Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) crates/koharu-torch/src/wrappers/jit.rs
  • Code Duplication · Edited copy of a member (9 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copy of a member (22 corresponding lines) crates/koharu-ml/src/comic_text_detector/mod.rs
  • Code Duplication · Edited copy of a member (9 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copy of a member (13 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) crates/koharu-torch/src/nn/batch_norm.rs
  • Code Duplication · Edited copy of a member (13 corresponding lines) crates/koharu-torch/src/nn/conv.rs
  • Code Duplication · Edited copy of a member (14 corresponding lines) crates/koharu-ml/src/rorem_mixed/processor.rs
  • Code Duplication · Edited copy of a member (20 corresponding lines) crates/koharu-ml/src/paddle_ocr_vl/model.rs
  • Code Duplication · Edited copy of a member (13 corresponding lines) crates/koharu/src/tracing.rs
  • Code Duplication · Edited copy of a member (14 corresponding lines) crates/koharu-scene/src/components/text.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) crates/koharu-diffusion/src/context.rs
  • Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) crates/koharu-ml/src/bin/baberu_ocr.rs
  • Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Edited copy of a member (9 corresponding lines) crates/koharu-torch/src/nn/var_store.rs
  • Code Duplication · Edited copy of a member (9 corresponding lines) crates/koharu-scene/src/snapshot.rs
  • Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) crates/koharu-ml/src/aot_inpainting/mod.rs
  • Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) crates/koharu-ml/src/aot_inpainting/processor.rs
  • Code Duplication · Edited copy of a member (7 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.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: 113 findings

These 113 critical or serious findings were in the previous survey, on 28 October 2026, and are gone from this one. The first 100 are listed here.

  • Code Duplication · Near-duplicate member pair (52 shared lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Near-duplicate member pair (42 shared lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Near-duplicate member pair (23 shared lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Edited copy of a member (26 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copy of a member (23 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Edited copy of a member (17 corresponding lines) crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs
  • Code Duplication · Edited copy of a member (16 corresponding lines) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs
  • Code Duplication · Duplicated block (31 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (25 lines × 4) crates/koharu-translator/src/remote/lm_studio.rs
  • Code Duplication · Duplicated block (24 lines × 5) crates/koharu-translator/src/remote/deepseek.rs
  • Code Duplication · Duplicated block (23 lines × 2) crates/koharu-torch/src/wrappers/kind.rs
  • Code Duplication · Duplicated block (15 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (14–15 lines × 2) crates/koharu-ml/src/flux2_klein/processor.rs
  • Code Duplication · Duplicated block (14 lines × 2) crates/koharu-renderer/src/renderer.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Duplicated block (13 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (12–13 lines × 2) crates/koharu-ml/src/pp_doclayout_v3/processor.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/koharu-ml/src/baberu_ocr/model.rs
  • Code Duplication · Duplicated block (12 lines × 2) crates/koharu-rasterizer/src/native.rs
  • Code Duplication · Duplicated block (10 lines × 3) crates/koharu-runtime/src/runtime/packages/diffusion.rs
  • Code Duplication · Duplicated block (3–10 lines × 3) crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Duplicated block (9 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Duplicated block (9 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs
  • Code Duplication · Duplicated block (8 lines × 3) crates/koharu-ml/src/aot_inpainting/processor.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/koharu-ml/src/aot_inpainting/processor.rs
  • Code Duplication · Duplicated block (8 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs
  • Code Duplication · Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-app/src/commands/canvas.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-ml/src/flux2_klein/mod.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-renderer/src/renderer.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-torch/src/wrappers/jit.rs
  • Code Duplication · Duplicated block (5 lines × 3) crates/koharu-ml/src/flux2_klein/mod.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/koharu-pipeline/src/stages/detection.rs
  • Code Duplication · Duplicated block (5 lines × 2) crates/koharu-torch/src/vision/resnet.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/model.rs
  • Code Duplication · Duplicated block (10 lines × 2) crates/koharu-runtime/src/runtime/packages/diffusion.rs
  • Code Duplication · Duplicated block (9 lines × 4) crates/koharu-pipeline/src/stages/inpainting.rs
  • Code Duplication · Duplicated block (6 lines × 2) crates/koharu-agent/src/codex/catalog.rs
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-renderer/src/layout.rs crates/koharu-renderer/src/layout.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/editor/Inspector.tsx packages/koharu/components/editor/Inspector.tsx
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/preferences/SettingsPage.tsx packages/koharu/components/preferences/SettingsPage.tsx
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/editor/PageRail.tsx packages/koharu/components/editor/PageRail.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-renderer/src/text_renderer.rs crates/koharu-renderer/src/text_renderer.rs
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-renderer/src/bubble.rs crates/koharu-renderer/src/bubble.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/controls/FontPicker.tsx packages/koharu/components/controls/FontPicker.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-translator/src/bin/translate.rs crates/koharu-translator/src/bin/translate.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/editor/CanvasOverlay.tsx packages/koharu/components/editor/CanvasOverlay.tsx
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/app/TitleBar.tsx packages/koharu/components/app/TitleBar.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-diffusion/src/enums.rs crates/koharu-diffusion/src/enums.rs
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-pipeline/src/stages/inpainting.rs crates/koharu-pipeline/src/stages/inpainting.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/editor/AgentPanel.tsx packages/koharu/components/editor/AgentPanel.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-scene/src/edit.rs crates/koharu-scene/src/edit.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/app/Updater.tsx packages/koharu/components/app/Updater.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-scene/src/schema.rs crates/koharu-scene/src/schema.rs
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-pipeline/src/stages/ocr.rs crates/koharu-pipeline/src/stages/ocr.rs
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/controls/OutputPicker.tsx packages/koharu/components/controls/OutputPicker.tsx
  • Churn × Complexity Hotspots · Hotspot: packages/koharu/components/controls/ModelPicker.tsx packages/koharu/components/controls/ModelPicker.tsx
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-translator/src/provider.rs crates/koharu-translator/src/provider.rs
  • Churn × Complexity Hotspots · Hotspot: crates/koharu-psd/src/document.rs crates/koharu-psd/src/document.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-runtime/src/hardware/mod.rs crates/koharu-runtime/src/hardware/mod.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-runtime/src/runtime/graph.rs crates/koharu-runtime/src/runtime/graph.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-runtime/src/runtime/loader.rs crates/koharu-runtime/src/runtime/loader.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-ml/src/paddle_ocr_vl/model.rs crates/koharu-ml/src/paddle_ocr_vl/model.rs
  • Churn × Complexity Hotspots · Repeated repair: crates/koharu-runtime/src/runtime/mod.rs crates/koharu-runtime/src/runtime/mod.rs
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium advisory (unsound): REDACTED REDACTED
  • Dependency Vulnerabilities · Medium vulnerability: [GHSA redacted] REDACTED
Rebuild cost: about €140,000 · Estimate
Cost to rebuild€45,000 to €230,000, for 755 to 2,396 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problemStandard, 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.9 at a score of 62. 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.
SizeLarge: 117,385 lines of product code
What it is notNot 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
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 3 points · Medium effort · Keyboard semantics
2
Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (14).
Raises the score by about 3 points · Medium effort · Static Analysis (SAST)
3
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with package.json.
Raises the score by about 1 point · Low effort · ADR Quality

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 €140,000 to build again, about 0.9 person-years of work. Its weakest lens is Accessibility, at 57 (Adequate). 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
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href. Of all the actions in this report, it raises the score most for the work it takes: about 3 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 6.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 38,145 lines over the last 90 days, which is about 154,699 lines a year. At that pace, the extra work comes to an estimated 10.2 to 61.4 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.

arch @koharu/app app koharu-agent koharu-agent koharu-config koharu-config koharu-agent->koharu-config koharu-runtime koharu-runtime koharu-agent->koharu-runtime koharu-secrets koharu-secrets koharu-agent->koharu-secrets koharu-app koharu-app koharu-app->koharu-agent koharu-desktop koharu-desktop koharu-app->koharu-desktop koharu-ml koharu-ml koharu-app->koharu-ml koharu-pipeline koharu-pipeline koharu-app->koharu-pipeline koharu-psd koharu-psd koharu-app->koharu-psd koharu-rasterizer koharu-rasterizer koharu-app->koharu-rasterizer koharu-renderer koharu-renderer koharu-app->koharu-renderer koharu-app->koharu-runtime koharu-scene koharu-scene koharu-app->koharu-scene koharu-app->koharu-secrets koharu-translator koharu-translator koharu-app->koharu-translator koharu-bindgen koharu-bindgen koharu-desktop->koharu-rasterizer koharu-desktop->koharu-renderer koharu-desktop->koharu-scene koharu-diffusion koharu-diffusion koharu-diffusion-sys koharu-diffusion-sys koharu-diffusion->koharu-diffusion-sys koharu-diffusion-sys->koharu-bindgen koharu-llama koharu-llama koharu-llama-sys koharu-llama-sys koharu-llama->koharu-llama-sys koharu-llama-sys->koharu-bindgen koharu-ml->koharu-diffusion koharu-ml->koharu-llama koharu-ml->koharu-runtime koharu-torch koharu-torch koharu-ml->koharu-torch koharu-pipeline->koharu-config koharu-pipeline->koharu-ml koharu-pipeline->koharu-rasterizer koharu-pipeline->koharu-renderer koharu-pipeline->koharu-scene koharu-pipeline->koharu-translator koharu-psd->koharu-rasterizer koharu-psd->koharu-renderer koharu-psd->koharu-scene koharu-renderer->koharu-config koharu-renderer->koharu-rasterizer koharu-renderer->koharu-runtime koharu-renderer->koharu-scene koharu-runtime->koharu-config koharu-translator->koharu-config koharu-translator->koharu-ml koharu-translator->koharu-runtime koharu-translator->koharu-secrets __more__ +6 more projects

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.

381 modules, with 905 dependencies between them. 12 loops run through 48 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 341 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.
uses →1 koharu_diffusion.params2 koharu_diffusion.system3 koharu_llama.model4 koharu_rasterizer.prepared5 koharu_storage.ids6 koharu_torch.wrappers.device7 koharu_torch.wrappers.kind8 koharu_translator.backend9 koharu_translator.provider10 koharu_scene.id11 koharu_torch.wrappers.tensor12 koharu_translator.model13 koharu_renderer.frame14 koharu_scene.components.provenance15 koharu_torch.nn.init16 koharu_torch.nn.module17 koharu_scene.component18 koharu_torch.nn.batch_norm19 koharu_torch.nn.layer_norm20 koharu_torch.nn.linear21 koharu_torch.nn.var_store22 koharu_ml.aot_inpainting.model23 koharu_ml.baberu_ocr.model24 koharu_ml.comic_layout_yolo26s.model25 koharu_ml.comic_text_bubble_detector.model26 koharu_scene.snapshot27 koharu_ml.comic_onomatopoeia.recognizer.model28 koharu_ml.hayai_ocr.model29 koharu_ml.pp_doclayout_v3.model30 koharu_ml.pp_ocr_v6.rec.model31 koharu_renderer.renderer32 koharu_scene.patch33 koharu_scene.edit34 koharu_scene.session35 koharu_app.commands.project36 koharu_pipeline.stages37 koharu_pipeline.stages.detection38 koharu_pipeline.config39 koharu_pipeline.stage_runner40 koharu_pipeline.execution
1 koharu_diffusion.params
2 koharu_diffusion.system
3 koharu_llama.model
4 koharu_rasterizer.prepared
5 koharu_storage.ids
6 koharu_torch.wrappers.device
7 koharu_torch.wrappers.kind
8 koharu_translator.backend
9 koharu_translator.provider
10 koharu_scene.id1
11 koharu_torch.wrappers.tensor111
12 koharu_translator.model2
13 koharu_renderer.frame1125
14 koharu_scene.components.provenance1
15 koharu_torch.nn.init112
16 koharu_torch.nn.module12
17 koharu_scene.component441
18 koharu_torch.nn.batch_norm111
19 koharu_torch.nn.layer_norm111
20 koharu_torch.nn.linear111
21 koharu_torch.nn.var_store2242
22 koharu_ml.aot_inpainting.model1109
23 koharu_ml.baberu_ocr.model143203618
24 koharu_ml.comic_layout_yolo26s.model120118
25 koharu_ml.comic_text_bubble_detector.model1322913625
26 koharu_scene.snapshot26111
27 koharu_ml.comic_onomatopoeia.recognizer.model1321044101
28 koharu_ml.hayai_ocr.model2211427122
29 koharu_ml.pp_doclayout_v3.model132404683015
30 koharu_ml.pp_ocr_v6.rec.model1812371
31 koharu_renderer.renderer116184
32 koharu_scene.patch6121
33 koharu_scene.edit32211
34 koharu_scene.session2121
35 koharu_app.commands.project261112
36 koharu_pipeline.stages111111
37 koharu_pipeline.stages.detection2311142
38 koharu_pipeline.config11
39 koharu_pipeline.stage_runner1121
40 koharu_pipeline.execution11213
Uses a module listed above itPart of a loopThe module itself
1 koharu_diffusion.params2 koharu_diffusion.system3 koharu_llama.model4 koharu_rasterizer.prepared5 koharu_storage.ids6 koharu_torch.wrappers.device7 koharu_torch.wrappers.kind8 koharu_translator.backend9 koharu_translator.provider10 koharu_scene.id11 koharu_torch.wrappers.tensor12 koharu_translator.model13 koharu_renderer.frame14 koharu_scene.components.provenance15 koharu_torch.nn.init16 koharu_torch.nn.module17 koharu_scene.component18 koharu_torch.nn.batch_norm19 koharu_torch.nn.layer_norm20 koharu_torch.nn.linear21 koharu_torch.nn.var_store22 koharu_ml.aot_inpainting.model23 koharu_ml.baberu_ocr.model24 koharu_ml.comic_layout_yolo26s.model25 koharu_ml.comic_text_bubble_detector.model26 koharu_scene.snapshot27 koharu_ml.comic_onomatopoeia.recognizer.model28 koharu_ml.hayai_ocr.model29 koharu_ml.pp_doclayout_v3.model30 koharu_ml.pp_ocr_v6.rec.model31 koharu_renderer.renderer32 koharu_scene.patch33 koharu_scene.edit34 koharu_scene.session35 koharu_app.commands.project36 koharu_pipeline.stages37 koharu_pipeline.stages.detection38 koharu_pipeline.config39 koharu_pipeline.stage_runner40 koharu_pipeline.executionkoharu_diffusion.params1koharu_diffusion.system2koharu_llama.model3koharu_rasterizer.prepared4koharu_storage.ids5koharu_torch.wrappers.device6koharu_torch.wrappers.kind7koharu_translator.backend8koharu_translator.provider9koharu_scene.id10koharu_torch.wrappers.tensor11koharu_translator.model12koharu_renderer.frame13koharu_scene.components.provenance14koharu_torch.nn.init15koharu_torch.nn.module16koharu_scene.component17koharu_torch.nn.batch_norm18koharu_torch.nn.layer_norm19koharu_torch.nn.linear20koharu_torch.nn.var_store21koharu_ml.aot_inpainting.model22koharu_ml.baberu_ocr.model23koharu_ml.comic_layout_yolo26s.model24koharu_ml.comic_text_bubble_detector.model25koharu_scene.snapshot26koharu_ml.comic_onomatopoeia.recognizer.model27koharu_ml.hayai_ocr.model28koharu_ml.pp_doclayout_v3.model29koharu_ml.pp_ocr_v6.rec.model30koharu_renderer.renderer31koharu_scene.patch32koharu_scene.edit33koharu_scene.session34koharu_app.commands.project35koharu_pipeline.stages36koharu_pipeline.stages.detection37koharu_pipeline.config38koharu_pipeline.stage_runner39koharu_pipeline.execution40111121125111212441111111111224211091432036181201181322913625261111321044101221142712213240468301518123711161846121322112121261112111111231114211112111213+341 more modules (most-connected shown)

At a glance — Code Health · 69% · Strong ·

At a glance — Architecture · 96% · Exemplary ·

At a glance — Maturity · 69% · Adequate · gated by M2 ·

At a glance — Readiness · 78% · Strong ·

At a glance — Security · 58% · Adequate · gated by D29, D36 ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Accessibility · 57% · Adequate · gated by AC4 ·

At a glance — Performance · 91% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures60High / Critical
A05:2025 — Injection47High / Critical

Roadmap

Top priorities: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (14); Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+3.5 ptsMediumKeyboard semantics
Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (14).+2.9 ptsMediumStatic Analysis (SAST)
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with package.json.+1.4 ptsLowADR Quality
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.+1.8 ptsMediumPage structure
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED.+0.8 ptsLowStatic Analysis (SAST)
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED.+0.8 ptsLowDependency Vulnerabilities
Resolve the 6 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6).+0.8 ptsLowDependency Vulnerabilities
Resolve the 22 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (22).+1.6 ptsMediumDependency Vulnerabilities

File quality

Per-file score 0–10 — a quality signature. Of 182 files carrying findings, judged against the Preview bar: 1% slop · 6% mixed · 93% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0MixedDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.7MixedStatic Analysis (SAST): Medium: REDACTED
crates/koharu-runtime/src/runtime/packages/diffusion.rs5.7MixedCode Duplication: Duplicated block (27 lines × 2)
crates/koharu-torch/src/tensor/npy.rs6.0MixedExplicit Debt: HackComment
crates/koharu-llama/src/model.rs6.0MixedExplicit Debt: TodoComment
crates/koharu-torch/src/wrappers/jit.rs6.0MixedExplicit Debt: TodoComment
crates/koharu-renderer/src/layout.rs7.0Near-cleanCyclomatic Complexity: TextLayout::run_with_size (cyclomatic 58)
crates/koharu-ml/src/comic_text_detector/processor.rs7.0Near-cleanCyclomatic Complexity: koharu_ml::comic_text_detector::processor::rearranged_inference (cyclomatic 33)
crates/koharu-scene/src/edit.rs7.0Near-cleanCyclomatic Complexity: Edit::remove_entity (cyclomatic 18)
crates/koharu-pipeline/src/stages/inpainting.rs7.0Near-cleanCyclomatic Complexity: Model::run (cyclomatic 16)
crates/koharu-pipeline/src/stages/detection.rs7.0Near-cleanCyclomatic Complexity: koharu_pipeline::stages::detection::infer_outline (cyclomatic 16)
crates/koharu-renderer/src/renderer.rs7.0Near-cleanCognitive Complexity: koharu_renderer::renderer::resolve_balloon_flows (cognitive 32)
crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs7.0Near-cleanCognitive Complexity: koharu_ml::comic_onomatopoeia::detector::processor::fill_polygon (cognitive 22)

How the grades work

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 — 54

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 — 808

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 — 53

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 14

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 62 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 — 62 dimensions across the health lenses
D1D2D3D4D5D6D10D12D13D14D15D17D19D20D26D28D29D30D34D35D36D43D44AC1AC2AC3AC4AC5AC6AX10AX3AX4AX9ES1ES2M1M2M3M4P1P10P2P3P4P6PF1PF3R1R10R2R3R4R6R7R8R9X1X21X28X29X4X5

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
  1. 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, 882 of 915 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.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1db6b-7700-7420-900e-b3464108eccd.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 98 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 29 test source file(s) (.rs) 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 reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for packages/koharu/ failed in the analyzer sandbox (npm error code EUNSUPPORTEDPROTOCOL), so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in packages/koharu/ was NOT MEASURED: the dependency install for packages/koharu/ failed in the analyzer sandbox (npm error code EUNSUPPORTEDPROTOCOL), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (55 contributor(s) across 2483 commit(s) sampled, automation and bot accounts excluded). One of them holds 85% of the history; the other 54 hold 0.3% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • 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. 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 — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `packages/koharu/components/editor/CanvasWorkspace.tsx`, `packages/koharu/components/editor/ToolBar.tsx`, `packages/koharu/components/preferences/PipelinePreferences.tsx`, `packages/koharu/components/preferences/models.ts`, `packages/koharu/lib/i18n.ts`, … (+1 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • 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'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.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. A program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. (rule: missing-tool). The renderer reported: the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> predev / > kill-port 3000 / sh: 1: kill-port: not found" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> predev / > kill-port 3000 / sh: 1: kill-port: not found" No runtime evidence was gathered.
  • 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 Python, Rust, c 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 Python, Rust, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • 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.
  • X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • 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.
  • 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.
  • 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.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • 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.
  • 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.

Dimensions

D1 · Cyclomatic Complexity5.6 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.6 / 10 · rule-coverage 100% · ceiling Prevented

36 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was CanvasWorkspace.CanvasWorkspace at 148. A further 24 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 koharu_ml::bin::pp_doclayout_v3::glyph_bits at 42 — they are counted neither in the figure above nor in this dimension's score. 10 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: crates/koharu-ml/src/bin/pp_doclayout_v3.rs (koharu_ml::bin::pp_doclayout_v3::glyph_bits at 42), crates/koharu-diffusion/src/enums.rs (WeightType::try_from at 39), crates/koharu-translator/src/remote/deepl.rs (koharu_translator::remote::deepl::target at 35), crates/koharu-llama/src/context/params.rs (KvCacheType::from at 33), crates/koharu-torch/src/wrappers/kind.rs (Kind::from_c_int at 21), and 5 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.

koharu_renderer::bubble::decompose_lobes (cyclomatic 19) · ×3crates/koharu-renderer/src/bubble.rs:116
TextLayout::run_with_size (cyclomatic 58) · ×2crates/koharu-renderer/src/layout.rs:463
koharu_ml::comic_text_detector::processor::rearranged_inference (cyclomatic 33) · ×2crates/koharu-ml/src/comic_text_detector/processor.rs:114
koharu_pipeline::stages::detection::infer_outline (cyclomatic 16) · ×2crates/koharu-pipeline/src/stages/detection.rs:760
CanvasWorkspace.CanvasWorkspace (cyclomatic 148)packages/koharu/components/editor/CanvasWorkspace.tsx:91

+ 26 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 1 body over 60 down to 60 or less in Cyclomatic Complexity — start with CanvasWorkspace.CanvasWorkspace (cyclomatic 148). — Refactoring it lifts Cyclomatic Complexity from 5.6 to about 6.5/10.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity5.5 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.5 / 10 · rule-coverage 100% · ceiling Prevented

89 method(s) exceeded the cognitive complexity threshold of 15; the worst was TextLayout::run_with_size at 157.

koharu_ml::comic_text_detector::processor::rearranged_inference (cognitive 99) · ×13crates/koharu-ml/src/comic_text_detector/processor.rs:114
koharu_renderer::layout::exact_profiled_line_breaks (cognitive 42) · ×10crates/koharu-renderer/src/layout.rs:1632
koharu_pipeline::stages::inpainting::prepare (cognitive 36) · ×8crates/koharu-pipeline/src/stages/inpainting.rs:430
TextLayout::run_with_size (cognitive 157) · ×6crates/koharu-renderer/src/layout.rs:463
Model::get_rope_index (cognitive 24) · ×4crates/koharu-ml/src/paddle_ocr_vl/model.rs:237

+ 44 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 2 bodies over 60 down to 60 or less in Cognitive Complexity — start with TextLayout::run_with_size (cognitive 157), koharu_ml::comic_text_detector::processor::rearranged_inference (cognitive 99). — 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 2 together lifts Cognitive Complexity from 5.5 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.1 / 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.

Maturity: Documented → Verified → Prevented · effective 7.1 / 10 · rule-coverage 100% · ceiling Prevented

103 god class(es) detected.

FileTooLong: pp_doclayout_v3/model.rs · ×36crates/koharu-ml/src/pp_doclayout_v3/model.rs
FunctionTooLong: CanvasWorkspace.CanvasWorkspace · ×26packages/koharu/components/editor/CanvasWorkspace.tsx:91
MethodTooLong: TextLayout.run_with_size · ×19crates/koharu-renderer/src/layout.rs:463
TooManyMethods: Tensor · ×10crates/koharu-torch/src/wrappers/tensor.rs:17
ClassTooLong: TextLayout · ×9crates/koharu-renderer/src/layout.rs:174

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 36 FileTooLong finding(s) in God Classes — start with model.rs (14), processor.rs (2), web.rs. — One of this dimension's main actionable groups (36 warning-level).
  2. Resolve the 26 FunctionTooLong finding(s) in God Classes — start with Inspector.tsx (4), CanvasWorkspace.tsx, AgentPanel.tsx. — One of this dimension's main actionable groups (26 warning-level).
  3. Resolve the 19 MethodTooLong finding(s) in God Classes — start with model.rs (4), layout.rs (2), processor.rs (2). — One of this dimension's main actionable groups (19 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication6.6 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 6.6 / 10 · rule-coverage 100% · ceiling Verified

217 duplicated block group(s) detected. 8.4 % of the production lines (9,861 of 117,385) are in a reported copy. A further 192 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (6 lines × 2) · ×30crates/koharu-app/src/commands/agent/host.rs:462
Duplicated block (9 lines × 2) · ×19crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:158
Duplicated block (8 lines × 2) · ×17crates/koharu-llama/src/context/kv_cache.rs:60
Edited copy of a member (9 corresponding lines) · ×15crates/koharu-ml/src/pp_doclayout_v3/model.rs:496
Duplicated block (5 lines × 2) · ×15crates/koharu-app/src/commands/agent/host.rs:37

+ 131 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 30 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with model.rs (10), processor.rs (5), frame.rs (3). — One of this dimension's main actionable groups (30 warning-level).
  2. Resolve the 19 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with processor.rs (6), model.rs (3), diffusion.rs (2). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 17 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with model.rs (6), processor.rs (4), kv_cache.rs. — One of this dimension's main actionable groups (17 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling7.1 / 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.

Maturity: Documented → Verified → Prevented · effective 7.1 / 10 · rule-coverage 100% · ceiling Prevented

26 production modules (Cargo+npm), 0 dependency cycle(s), 2 unstable depended-on module(s). Read from the build's own module declarations; 7 module(s) off the main sequence, with abstractness counted on 24 of the 26 (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: @koharu/ui · ×7
Unstable project koharu-app
Unstable project koharu-pipeline

What to do

  1. Resolve the 7 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 1 Unstable project koharu-app finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project koharu-pipeline 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.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 307 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 98 tests. Measured on the JavaScript/TypeScript suite only — at least 29 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.

Mock-dominated test: lets a cached canvas frame paint before synchronizing native page statepackages/koharu/tests/components/editor-components.test.tsx:563

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.

D12 · Dependency Hygiene9.6 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Verified

9 outdated, 0 yanked direct Cargo dependencies. Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Outdated: icu_normalizer · ×9

✓ On the Gold path — maintain.

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 1050 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 17 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. This repository publishes itself under MIT OR Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.9 / 10Stronggated by 18 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: packages/koharu/components/editor/CanvasWorkspace.tsx (5×148=740); packages/koharu/components/editor/InferenceControl.tsx (7×26=182); crates/koharu-rasterizer/src/compositor.rs (3×19=57) Repeated repair below the complexity floor: crates/koharu-runtime/src/runtime/packages/torch.rs (13 of 20 changes were fixes); crates/koharu-runtime/src/runtime/packages/rocm.rs (11 of 19 changes were fixes); crates/koharu-translator/src/lib.rs (4 of 7 changes were fixes)

Repeated repair: crates/koharu-runtime/src/runtime/packages/torch.rs · ×15crates/koharu-runtime/src/runtime/packages/torch.rs:116
Hotspot: packages/koharu/components/editor/CanvasWorkspace.tsx · ×3packages/koharu/components/editor/CanvasWorkspace.tsx:91

What to do

  1. Resolve the 15 Repeated repair finding(s) in Churn × Complexity Hotspots — start with torch.rs, rocm.rs, lib.rs. — One of this dimension's main actionable groups (15 warning-level).
  2. Resolve the 3 Hotspot finding(s) in Churn × Complexity Hotspots — start with CanvasWorkspace.tsx, InferenceControl.tsx, compositor.rs. — One of this dimension's main actionable groups (3 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 9 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

9 deducted task-comment markers across 117385 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×8crates/koharu-torch/src/wrappers/jit.rs:29
HackCommentcrates/koharu-torch/src/tensor/npy.rs:78

What to do

  1. Resolve the 8 TodoComment finding(s) in Explicit Debt — start with convert.rs (2), model.rs (2), jit.rs. — One of this dimension's main actionable groups (8 warning-level).
  2. Resolve the 1 HackComment finding(s) in Explicit Debt — start with npy.rs. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

2 of 2 documentation facets pass in full. 95 document(s) read across 5 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundpackages/koharu/package.json:8

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with package.json. — 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.

D26 · Project Cohesion9.3 / 10Exemplary✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Documented

1 of 27 build units (Cargo, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

✓ On the Gold path — maintain.

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)0.6 / 10Critical✓ Tool-verified

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).

Maturity: Documented → Verified → Prevented · effective 0.6 / 10 · rule-coverage 100% · ceiling Documented

47 finding(s): 0 critical, 44 high, 3 medium, 0 low. 29 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 19 file(s) — `crates/koharu-diffusion-sys/include/stable-diffusion.h`, `crates/koharu-llama-sys/include/ggml-alloc.h` (line 21, line 22, line 50, …), `crates/koharu-llama-sys/include/ggml-backend.h` (line 37, line 40, line 41, …), `crates/koharu-llama-sys/include/ggml-cpu.h` (line 37, line 38, line 40, …), `crates/koharu-llama-sys/include/ggml-opt.h` (line 46, line 49, line 50, …), … (+14 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.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (14). — One of this dimension's main actionable groups (14 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. No action in Static Analysis (SAST) — all 29 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (29 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

56 finding(s): 1 critical, 6 high, 47 medium, 2 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 22 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (22). — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 6 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 issue-level).
  3. Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 330 of the 468 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling10.0 / 10Stronggated by 2 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: diffusion.rs↔llama.rs 80%; mod.rs↔mod.rs 50%

Change coupling: diffusion.rs ↔ llama.rs · ×2crates/koharu-runtime/src/runtime/packages/diffusion.rs:1

What to do

  1. Resolve the 2 Change coupling finding(s) in Change Coupling — start with diffusion.rs, mod.rs. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

1/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. 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.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 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.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

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.

AC2 · Forms & labels6.5 / 10Strong✓ 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 UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. — packages/koharu/components/preferences/SettingsPage.tsx:277

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.
AC3 · Page structure5.6 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component. — packages/koharu/app/global-error.tsx:22
  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — packages/koharu/app/layout.tsx:24

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.
AC4 · Keyboard semantics2.7 / 10Weak✓ Tool-verified

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".

  • This <div> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its only behaviour is bound to wheel, pointerdown, pointerup and pointermove, pointer gestures a keyboard cannot produce, and there is no key handler. The tab stop leads nowhere. Bind the same behaviour to a key handler, or provide an equivalent control elsewhere. Give it a role as well, so assistive tech can announce what it is. — packages/koharu/components/editor/CanvasWorkspace.tsx:591
  • A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. — packages/koharu/components/editor/PageRail.tsx:472

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

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.

AC6 · Visual & motion safety6.4 / 10Adequate✓ Tool-verified

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.

  • <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — packages/koharu/components/editor/CanvasWorkspace.tsx:591

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.
AX10 · Code composition9.7 / 10Exemplary✓ Tool-verified

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.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

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.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

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.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

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.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

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.

M1 · Documentation (README)8.2 / 10Exemplary✓ Tool-verified

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.
M2 · Architecture documentation2.0 / 10Weak✓ Tool-verified

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.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability8.6 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 15/17 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/koharu-bindgen`, `packages/koharu`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add a health-check endpoint (a /health route on your axum/actix router) so orchestrators and load balancers can probe liveness/readiness.
P3 · Security & performance tooling8.0 / 10Strong✓ Tool-verified

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

  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

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.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

PF1 · Benchmark discipline8.5 / 10Exemplary✓ Tool-verified

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.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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.

R1 · Type Safety10.0 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

R10 · Code Duplication5.6 / 10Adequate✓ Tool-verified

React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.

  • 8 duplicated blocks under packages/koharu/components/ have copies in at least two of the sibling directories app, controls, editor, preferences, start — 3 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/koharu/components/controls/OutputPicker.tsx:130
  • packages/ui/src/components/context-menu.tsx:37 · packages/ui/src/components/dropdown-menu.tsx:28 — the two spans are one implementation copied and then locally edited — 707 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/ui/src/components/context-menu.tsx:37
  • packages/ui/src/components/dialog.tsx:10 · packages/ui/src/components/sheet.tsx:10 — the two spans are one implementation copied and then locally edited — 336 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/ui/src/components/dialog.tsx:10
  • packages/ui/src/components/combobox.tsx:93 · packages/ui/src/components/select.tsx:64 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/ui/src/components/combobox.tsx:93
  • packages/ui/src/components/drawer.tsx:163 · packages/ui/src/components/popover.tsx:46 · packages/ui/src/components/sheet.tsx:79 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/drawer.tsx:163
  • packages/ui/src/components/empty.tsx:34 · packages/ui/src/components/item.tsx:91 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/empty.tsx:34
  • packages/ui/src/components/field.tsx:10 · packages/ui/src/components/message.tsx:5 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/ui/src/components/field.tsx:10
  • packages/ui/src/components/context-menu.tsx:155 · packages/ui/src/components/menubar.tsx:109 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — packages/ui/src/components/context-menu.tsx:155
  • packages/ui/src/components/popover.tsx:8 · packages/ui/src/components/tooltip.tsx:20 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/ui/src/components/popover.tsx:8
  • packages/ui/src/components/carousel.tsx:174 · packages/ui/src/components/carousel.tsx:204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/ui/src/components/carousel.tsx:174
  • packages/koharu/components/editor/PageRail.tsx:328 · packages/koharu/components/start/StartView.tsx:107 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — packages/koharu/components/editor/PageRail.tsx:328
  • packages/ui/src/components/context-menu.tsx:27 · packages/ui/src/components/hover-card.tsx:13 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/context-menu.tsx:27
  • packages/koharu/components/preferences/GenerationPreferences.tsx:38 · packages/koharu/components/preferences/GenerationPreferences.tsx:54 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/koharu/components/preferences/GenerationPreferences.tsx:38
  • packages/koharu/components/controls/ModelPicker.tsx:55 · packages/koharu/components/controls/OutputPicker.tsx:103 — the two spans are one implementation copied and then locally edited — 61 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/koharu/components/controls/ModelPicker.tsx:55
  • packages/koharu/components/controls/ModelPicker.tsx:53 · packages/koharu/components/editor/InferenceControl.tsx:386 — the two spans are one implementation copied and then locally edited — 54 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/koharu/components/controls/ModelPicker.tsx:53
  • packages/ui/src/components/attachment.tsx:59 · packages/ui/src/components/empty.tsx:37 · packages/ui/src/components/item.tsx:94 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/attachment.tsx:59
  • packages/ui/src/components/breadcrumb.tsx:36 · packages/ui/src/components/bubble.tsx:59 · packages/ui/src/components/button-group.tsx:35 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/breadcrumb.tsx:36
  • packages/ui/src/components/button-group.tsx:25 · packages/ui/src/components/field.tsx:72 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/ui/src/components/button-group.tsx:25
  • packages/koharu/components/editor/ActivityCenter.tsx:117 · packages/koharu/components/editor/ActivityCenter.tsx:170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/koharu/components/editor/ActivityCenter.tsx:117
  • packages/ui/src/components/accordion.tsx:11 · packages/ui/src/components/avatar.tsx:23 · packages/ui/src/components/combobox.tsx:165 · packages/ui/src/components/combobox.tsx:185 · +7 more site(s) not listed — the 11 copies are spread across 10 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/accordion.tsx:11
  • packages/ui/src/components/alert.tsx:37 · packages/ui/src/components/attachment.tsx:83 · packages/ui/src/components/avatar.tsx:73 · packages/ui/src/components/breadcrumb.tsx:19 · +13 more site(s) not listed — the 17 copies are spread across 13 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/alert.tsx:37
  • packages/ui/src/components/alert.tsx:32 · packages/ui/src/components/attachment.tsx:75 · packages/ui/src/components/avatar.tsx:68 · packages/ui/src/components/breadcrumb.tsx:14 · +14 more site(s) not listed — the 18 copies are spread across 13 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/alert.tsx:32
  • packages/ui/src/components/button.tsx:43 · packages/ui/src/components/toggle.tsx:30 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/ui/src/components/button.tsx:43
  • packages/koharu/components/editor/ActivityCenter.tsx:90 · packages/koharu/components/editor/ActivityCenter.tsx:183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/koharu/components/editor/ActivityCenter.tsx:90
  • packages/koharu/components/editor/AgentPanel.tsx:157 · packages/koharu/components/editor/Inspector.tsx:297 · packages/koharu/components/preferences/SettingsPage.tsx:288 — the 3 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — packages/koharu/components/editor/AgentPanel.tsx:157
  • packages/ui/src/components/item.tsx:61 · packages/ui/src/components/marker.tsx:23 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/ui/src/components/item.tsx:61
  • packages/koharu/components/editor/CanvasWorkspace.tsx:901 · packages/koharu/components/editor/Inspector.tsx:1032 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — packages/koharu/components/editor/CanvasWorkspace.tsx:901
  • packages/koharu/components/preferences/GenerationPreferences.tsx:46 · packages/koharu/components/preferences/PipelinePreferences.tsx:122 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — packages/koharu/components/preferences/GenerationPreferences.tsx:46
  • packages/ui/src/components/alert-dialog.tsx:4 · packages/ui/src/components/dialog.tsx:6 · packages/ui/src/components/sheet.tsx:6 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/ui/src/components/alert-dialog.tsx:4
  • packages/bridge/src/canvas.ts:258 · packages/koharu/components/editor/useCanvas.ts:173 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/bridge/src/canvas.ts:258

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R2 · Cyclomatic Complexity9.6 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • (anonymous) has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:601
  • TypeInspector has cyclomatic complexity 27 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/Inspector.tsx:131
  • layerFrame has cyclomatic complexity 21 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/lib/geometry.ts:65
  • SettingsPage has cyclomatic complexity 21 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/preferences/SettingsPage.tsx:58
  • RuntimeSelector has cyclomatic complexity 20 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/InferenceControl.tsx:86
  • down has cyclomatic complexity 19 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:343
  • (anonymous) has cyclomatic complexity 18 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:202
  • finishGesture has cyclomatic complexity 17 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:503
  • Updater has cyclomatic complexity 17 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/app/Updater.tsx:31
  • (anonymous) has cyclomatic complexity 17 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/controls/ModelPicker.tsx:112
  • moveGesture has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:431
  • TitleBar has cyclomatic complexity 16 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/app/TitleBar.tsx:40
  • CanvasWorkspace has cyclomatic complexity 16 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:91
  • AgentPanel has cyclomatic complexity 14 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/AgentPanel.tsx:38
  • replaceStage has cyclomatic complexity 14 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/preferences/models.ts:59
  • ModelPicker has cyclomatic complexity 13 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/controls/ModelPicker.tsx:18
  • (anonymous) has cyclomatic complexity 12 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:763
  • getPayloadConfigFromPayload has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:330
  • scriptRank has cyclomatic complexity 12 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/controls/FontPicker.tsx:510
  • (anonymous) has cyclomatic complexity 12 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasWorkspace.tsx:305
  • prefetchCanvasPages has cyclomatic complexity 11 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/bridge/src/canvas.ts:246
  • selectLayer has cyclomatic complexity 11 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/Inspector.tsx:552
  • JobItem has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/ActivityCenter.tsx:104
  • LayerRow has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/Inspector.tsx:643
  • GenerationPreferences has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/preferences/GenerationPreferences.tsx:13
  • TranslationPreferences has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/preferences/TranslationPreferences.tsx:32
  • CanvasOverlay has cyclomatic complexity 11 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/koharu/components/editor/CanvasOverlay.tsx:33
R3 · Large Files7.9 / 10Strong✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • packages/koharu/components/editor/Inspector.tsx has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/koharu/components/editor/Inspector.tsx:1
  • packages/koharu/components/editor/CanvasWorkspace.tsx has 978 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/koharu/components/editor/CanvasWorkspace.tsx:1
  • packages/ui/src/components/sidebar.tsx has 674 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/ui/src/components/sidebar.tsx:1
  • packages/koharu/components/editor/PageRail.tsx has 555 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/koharu/components/editor/PageRail.tsx:1
  • packages/koharu/components/controls/FontPicker.tsx has 520 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/koharu/components/controls/FontPicker.tsx:1
  • packages/koharu/components/editor/InferenceControl.tsx has 433 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/koharu/components/editor/InferenceControl.tsx:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage9.2 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×9) — packages/koharu/components/editor/AgentPanel.tsx:1, packages/koharu/components/editor/Editor.tsx:1, packages/koharu/components/app/KoharuApp.tsx:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code9.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 71 application, 6 tooling and 14 test entry point(s) detected in this repo. Gate removals on `bun run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (71 application, 6 tooling, 14 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make — packages/koharu/instrumentation-client.ts
  • Nothing imports this binding — it is safe to review for removal. — packages/koharu/lib/backend.ts:31
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. — packages/koharu/components/editor/ToolBar.tsx:181

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene8.0 / 10Strong✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×4)

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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.

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.

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.

X4 · Structured logging5.5 / 10Adequate✓ Tool-verified

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.

  • `debug!` at line 212 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: `debug!(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/koharu-diffusion/src/callbacks.rs:212
  • `info!` at line 214 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/koharu-diffusion/src/callbacks.rs:214
  • `warn!` at line 215 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/koharu-diffusion/src/callbacks.rs:215
  • `error!` at line 216 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: `error!(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/koharu-diffusion/src/callbacks.rs:216

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types7.8 / 10Strong✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • 3/4 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
  • ~0.6 `!` null assertions per 1k TypeScript source lines — 11 assertion(s) across the 17646 source line(s) of the 114 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: packages/koharu/components/editor/CanvasWorkspace.tsx (6), packages/koharu/components/editor/Inspector.tsx (3), packages/koharu/components/editor/CanvasCommandBar.tsx (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

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).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health69%StrongSolid.
Architecture96%ExemplarySolid.
Maturity69%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness78%StrongSolid.
Security58%Adequate — gated by D29, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event Sourcing100%ExemplaryStrongest area.
Accessibility57%Adequate — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance91%ExemplarySolid.
Unscored — 2 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 19 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 7 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 65 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: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. 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 — AX6 reached only 13% of this repository's production lines — rust (100,873 lines), c (6,588 lines), python (29 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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 — the dev server (`npm run dev`) exited before it served a page. Likely cause (our sandbox): a program the dev server needs is not installed in our sandbox image. This is a limit of our sandbox, not of your repository. Last output: "> predev / > kill-port 3000 / sh: 1: kill-port: not found" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • 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 — D21 withholds its case and prefix conventions rows: 10 candidate(s) found and not reported.
  • 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. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
  • 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.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 6 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: the JavaScript/TypeScript half could not be measured — packages/koharu/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 66 value object(s); 2 domain event(s); its domain events are published by services or handlers — no domain entity raises one
  • 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'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Rust source, so there is no service whose uptime a failing dependency could take down
  • 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.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — uses a bun lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • S1 Web-Security Posture — No web surface: 374 Rust file(s) were read for weak hashes and ciphers, key material fixed in the source, disabled TLS certificate validation and obsolete TLS versions, and none was found. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker. If this codebase starts serving HTTP, the dimension reactivates automatically.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X12 Unreachable branch — X12 reached only 13% of this repository's production lines — rust (100,873 lines), c (6,588 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
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 13% of this repository's production lines — rust (100,873 lines), c (6,588 lines), python (29 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 Python and Rust were read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation; 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 — X24 reached only 13% of this repository's production lines — rust (100,873 lines), c (6,588 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — X3 reached only 13% of this repository's production lines — rust (100,873 lines), c (6,588 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — 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.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 54 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 4 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC3 · Page structure · Document without a <title> · ×1
  • Document without a <title> packages/koharu/app/global-error.tsx:22 — A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component.
AC4 · Keyboard semantics · Focusable <div> isn't keyboard-operable · ×1
  • Focusable <div> isn't keyboard-operable packages/koharu/components/editor/CanvasWorkspace.tsx:591 — This <div> carries tabIndex={0}, so it is in the tab order and a keyboard user will land on it — but its only behaviour is bound to wheel, pointerdown, pointerup and pointermove, pointer gestures a keyboard cannot produce, and there is no key handler. The tab stop leads nowhere. Bind the same behaviour to a key handler, or provide an equivalent control elsewhere. Give it a role as well, so assistive tech can announce what it is.
AC4 · Keyboard semantics · Click handler on a non-interactive <article> · ×1
  • Click handler on a non-interactive <article> packages/koharu/components/editor/PageRail.tsx:472 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×1
  • REDACTED
Serious — 808 finding(s)
D3 · God Classes · FileTooLong · ×36
  • FileTooLong: pp_doclayout_v3/model.rs crates/koharu-ml/src/pp_doclayout_v3/model.rs — FileTooLong — 1778 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 1278 over it, 3.56× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/web.rs crates/koharu-canvas/src/web.rs — FileTooLong — 1536 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 1036 over it, 3.07× 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/layout.rs crates/koharu-renderer/src/layout.rs — FileTooLong — 1536 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 1036 over it, 3.07× 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: stages/detection.rs crates/koharu-pipeline/src/stages/detection.rs — FileTooLong — 1368 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 66 free functions. The bar is 500 significant lines; this is 868 over it, 2.74× 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: comic_text_bubble_detector/model.rs crates/koharu-ml/src/comic_text_bubble_detector/model.rs — FileTooLong — 1324 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 824 over it, 2.65× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/renderer.rs crates/koharu-renderer/src/renderer.rs — FileTooLong — 1301 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 801 over it, 2.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: commands/project.rs crates/koharu-app/src/commands/project.rs — FileTooLong — 1034 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 75% of them inside a single declaration: Project (2 blocks, 254-1238). The bar is 500 significant lines; this is 534 over it, 2.07× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: comic_text_detector/processor.rs crates/koharu-ml/src/comic_text_detector/processor.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 43 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/params.rs crates/koharu-diffusion/src/params.rs — FileTooLong — 977 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 477 over it, 1.95× 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: local/catalog.rs crates/koharu-translator/src/local/catalog.rs — FileTooLong — 924 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 424 over it, 1.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: editor/Inspector.tsx packages/koharu/components/editor/Inspector.tsx — FileTooLong — 899 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 399 over it, 1.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: koharu_layout_rfdetr_seg_2xl/model.rs crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs — FileTooLong — 892 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 392 over it, 1.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/fonts.rs crates/koharu-renderer/src/fonts.rs — FileTooLong — 869 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 369 over it, 1.74× 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: editor/CanvasWorkspace.tsx packages/koharu/components/editor/CanvasWorkspace.tsx — FileTooLong — 843 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: CanvasWorkspace (91-899). The bar is 500 significant lines; this is 343 over it, 1.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/state.rs crates/koharu-scene/src/state.rs — FileTooLong — 816 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 316 over it, 1.63× 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: paddle_ocr_vl/model.rs crates/koharu-ml/src/paddle_ocr_vl/model.rs — FileTooLong — 783 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 283 over it, 1.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/compositor.rs crates/koharu-rasterizer/src/compositor.rs — FileTooLong — 765 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 60% of them inside a single declaration: GpuCompositor (2 blocks, 195-789). The bar is 500 significant lines; this is 265 over it, 1.53× 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: manga_ocr/model.rs crates/koharu-ml/src/manga_ocr/model.rs — FileTooLong — 741 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 241 over it, 1.48× 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: baberu_ocr/model.rs crates/koharu-ml/src/baberu_ocr/model.rs — FileTooLong — 718 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 218 over it, 1.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: comic_text_detector/model.rs crates/koharu-ml/src/comic_text_detector/model.rs — FileTooLong — 710 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 210 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/edit.rs crates/koharu-scene/src/edit.rs — FileTooLong — 705 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: Edit (2 blocks, 31-905). The bar is 500 significant lines; this is 205 over it, 1.41× 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/prepared.rs crates/koharu-rasterizer/src/prepared.rs — FileTooLong — 655 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 155 over it, 1.31× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: stages/inpainting.rs crates/koharu-pipeline/src/stages/inpainting.rs — FileTooLong — 651 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 151 over it, 1.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: recognizer/model.rs crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs — FileTooLong — 634 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 134 over it, 1.27× 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: llm/model.rs crates/koharu-ml/src/llm/model.rs — FileTooLong — 604 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 61% of them inside a single declaration: Model (3 blocks, 41-576). The bar is 500 significant lines; this is 104 over it, 1.21× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×30
  • Duplicated block (6 lines × 2) crates/koharu-app/src/commands/agent/host.rs:462 — crates/koharu-app/src/commands/agent/host.rs:462-467 | crates/koharu-app/src/commands/processing.rs:180-185 — 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) crates/koharu-app/src/commands/canvas.rs:148 — crates/koharu-app/src/commands/canvas.rs:148-153 | crates/koharu-app/src/commands/canvas.rs:174-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-app/src/commands/canvas.rs:148` 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) crates/koharu-ml/src/aot_inpainting/processor.rs:187 — crates/koharu-ml/src/aot_inpainting/processor.rs:187-192 | crates/koharu-ml/src/lama/processor.rs:287-292 — 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/koharu-ml/src/aot_inpainting/processor.rs:187` 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/koharu-ml/src/baberu_ocr/model.rs:897 — crates/koharu-ml/src/baberu_ocr/model.rs:897-902 | crates/koharu-ml/src/hayai_ocr/model.rs:804-809 — 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) crates/koharu-ml/src/bin/aot_inpainting.rs:27 — crates/koharu-ml/src/bin/aot_inpainting.rs:27-32 | crates/koharu-ml/src/bin/lama.rs:24-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:122 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:122-127 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:146-151 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:122` 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/koharu-ml/src/comic_text_detector/model.rs:701 — crates/koharu-ml/src/comic_text_detector/model.rs:701-706 | crates/koharu-ml/src/comic_text_detector/model.rs:831-836 — both copies are in the same file, so extract the block into 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) crates/koharu-ml/src/flux2_klein/mod.rs:81 — crates/koharu-ml/src/flux2_klein/mod.rs:81-86 | crates/koharu-ml/src/flux2_klein/mod.rs:233-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-ml/src/flux2_klein/mod.rs:81` 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) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:399 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:399-404 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:399-406 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:422 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:422-427 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:424-429 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) crates/koharu-pipeline/src/stages/inpainting.rs:817 — crates/koharu-pipeline/src/stages/inpainting.rs:817-823 | crates/koharu-renderer/src/bubble.rs:502-507 — 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/koharu-pipeline/src/stages/inpainting.rs:817` 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/koharu-rasterizer/src/frame.rs:34 — crates/koharu-rasterizer/src/frame.rs:34-39 | crates/koharu-renderer/src/frame.rs:41-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/koharu-renderer/src/frame.rs:48` calls `field`, `diagnostics`, `stats` and `crates/koharu-rasterizer/src/frame.rs:41` 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 × 2) crates/koharu-torch/src/wrappers/jit.rs:686 — crates/koharu-torch/src/wrappers/jit.rs:686-691 | crates/koharu-torch/src/wrappers/jit.rs:699-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-torch/src/wrappers/jit.rs:686` 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) crates/koharu-app/src/commands/canvas.rs:390 — crates/koharu-app/src/commands/canvas.rs:390-395 | crates/koharu-app/src/commands/project.rs:1274-1279 — 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/koharu-app/src/commands/canvas.rs:390` 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:313 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:313-318 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:206-211 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:66 — crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:66-71 | crates/koharu-ml/src/manga_text_mask/processor.rs:27-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/pp_doclayout_v3/model.rs:2228 — crates/koharu-ml/src/pp_doclayout_v3/model.rs:2228-2233 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2234-2239 — both copies are in the same file, so extract the block into 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) crates/koharu-pipeline/src/resources/vram.rs:158 — crates/koharu-pipeline/src/resources/vram.rs:158-163 | crates/koharu-pipeline/src/resources/windows.rs:105-110 — 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 (6 lines × 2) crates/koharu-pipeline/src/stages/detection.rs:1429 — crates/koharu-pipeline/src/stages/detection.rs:1429-1434 | crates/koharu-pipeline/src/stages/inpainting.rs:496-501 — 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/koharu-pipeline/src/stages/detection.rs:1429` 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) crates/koharu-ml/src/baberu_ocr/model.rs:889 — crates/koharu-ml/src/baberu_ocr/model.rs:889-894 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:901-906 — 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:418 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:418-423 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:421-426 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1730 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1730-1735 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2262-2267 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/pp_doclayout_v3/model.rs:813 — crates/koharu-ml/src/pp_doclayout_v3/model.rs:813-818 | crates/koharu-ml/src/pp_ocr_v6/pp_lcnet_v4.rs:275-280 — 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) crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:581 — crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:581-586 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:648-653 — `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:588 — crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:588-593 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:674-679 — `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:682` calls `forward_detection` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:596` 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.
  • + 5 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×26
  • FunctionTooLong: CanvasWorkspace.CanvasWorkspace packages/koharu/components/editor/CanvasWorkspace.tsx:91 — FunctionTooLong — CanvasWorkspace runs 670 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 570 over it, 6.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: AgentPanel.AgentPanel packages/koharu/components/editor/AgentPanel.tsx:38 — FunctionTooLong — AgentPanel runs 272 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 172 over it, 2.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: PageRail.PageRail packages/koharu/components/editor/PageRail.tsx:69 — FunctionTooLong — PageRail runs 269 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Inspector.TypeInspector packages/koharu/components/editor/Inspector.tsx:131 — FunctionTooLong — TypeInspector runs 262 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 162 over it, 2.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.
  • FunctionTooLong: StartView.StartView packages/koharu/components/start/StartView.tsx:27 — FunctionTooLong — StartView runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: InferenceControl.RuntimeSelector packages/koharu/components/editor/InferenceControl.tsx:86 — FunctionTooLong — RuntimeSelector runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: TitleBar.TitleBar packages/koharu/components/app/TitleBar.tsx:40 — FunctionTooLong — TitleBar runs 223 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 123 over it, 2.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: koharu_psd::engine_data::encode_engine_data crates/koharu-psd/src/engine_data.rs:46 — FunctionTooLong — koharu_psd::engine_data::encode_engine_data runs 166 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 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: koharu_ml::comic_text_detector::processor::rearranged_inference crates/koharu-ml/src/comic_text_detector/processor.rs:114 — FunctionTooLong — koharu_ml::comic_text_detector::processor::rearranged_inference runs 162 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 62 over it, 1.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.
  • FunctionTooLong: SettingsPage.SettingsPage packages/koharu/components/preferences/SettingsPage.tsx:58 — FunctionTooLong — SettingsPage runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: koharu_app::app::run crates/koharu-app/src/app.rs:56 — FunctionTooLong — koharu_app::app::run runs 144 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 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ModelPicker.ModelPicker packages/koharu/components/controls/ModelPicker.tsx:18 — FunctionTooLong — ModelPicker runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: FontPicker.FontPicker packages/koharu/components/controls/FontPicker.tsx:50 — FunctionTooLong — FontPicker runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) 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: calendar.Calendar packages/ui/src/components/calendar.tsx:15 — FunctionTooLong — Calendar runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× 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: Updater.Updater packages/koharu/components/app/Updater.tsx:31 — FunctionTooLong — Updater runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: koharu_app::commands::processing::process crates/koharu-app/src/commands/processing.rs:77 — FunctionTooLong — koharu_app::commands::processing::process runs 123 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 23 over it, 1.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: TranslationPreferences.TranslationPreferences packages/koharu/components/preferences/TranslationPreferences.tsx:32 — FunctionTooLong — TranslationPreferences runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: Inspector.LayerEditor packages/koharu/components/editor/Inspector.tsx:771 — FunctionTooLong — LayerEditor runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.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.
  • FunctionTooLong: Inspector.LayersInspector packages/koharu/components/editor/Inspector.tsx:493 — FunctionTooLong — LayersInspector runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: OutputPicker.OutputPicker packages/koharu/components/controls/OutputPicker.tsx:24 — FunctionTooLong — OutputPicker runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.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.
  • FunctionTooLong: Inspector.LayerRow packages/koharu/components/editor/Inspector.tsx:643 — FunctionTooLong — LayerRow runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.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.
  • FunctionTooLong: useCanvas.useCanvas packages/koharu/components/editor/useCanvas.ts:25 — FunctionTooLong — useCanvas runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× 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: SelectionControls.SelectionControls packages/koharu/components/editor/SelectionControls.tsx:46 — FunctionTooLong — SelectionControls runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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: koharu_psd::document::build crates/koharu-psd/src/document.rs:88 — FunctionTooLong — koharu_psd::document::build runs 111 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 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: TypesettingPreferences.TypesettingPreferences packages/koharu/components/preferences/TypesettingPreferences.tsx:13 — FunctionTooLong — TypesettingPreferences runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× 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.
  • + 1 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×22
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · MethodTooLong · ×19
  • MethodTooLong: TextLayout.run_with_size crates/koharu-renderer/src/layout.rs:463 — MethodTooLong — run_with_size runs 319 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 219 over it, 3.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: KoharuHost.invoke crates/koharu-app/src/commands/agent/host.rs:233 — MethodTooLong — invoke runs 162 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 62 over it, 1.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: Model.run crates/koharu-pipeline/src/stages/inpainting.rs:177 — MethodTooLong — run 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.
  • MethodTooLong: TextRenderer.render_descriptor crates/koharu-renderer/src/text_renderer.rs:148 — MethodTooLong — render_descriptor runs 145 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 45 over it, 1.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: YoloV5.new crates/koharu-ml/src/comic_text_detector/model.rs:360 — MethodTooLong — new runs 142 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 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: GpuCompositor.render crates/koharu-rasterizer/src/compositor.rs:453 — MethodTooLong — render 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.
  • MethodTooLong: KoharuLayoutRFDetrImageProcessor.postprocess crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:75 — MethodTooLong — postprocess 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.
  • MethodTooLong: ContextParams.to_native crates/koharu-diffusion/src/params.rs:199 — MethodTooLong — to_native runs 125 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 25 over it, 1.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: RTDetrV2Model.new crates/koharu-ml/src/comic_text_bubble_detector/model.rs:111 — MethodTooLong — new runs 125 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 25 over it, 1.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: PPDocLayoutV3Model.new crates/koharu-ml/src/pp_doclayout_v3/model.rs:90 — MethodTooLong — new runs 124 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 24 over it, 1.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.
  • MethodTooLong: Operation.apply crates/koharu-scene/src/patch.rs:76 — MethodTooLong — apply runs 119 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 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: VideoGenerationParams.to_native crates/koharu-diffusion/src/params.rs:1039 — MethodTooLong — to_native runs 118 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 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Flux2KleinInpaint.inference crates/koharu-ml/src/flux2_klein/mod.rs:149 — MethodTooLong — inference runs 115 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 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Traversal.text_draft crates/koharu-renderer/src/renderer.rs:714 — MethodTooLong — text_draft runs 112 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 12 over it, 1.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: PPDocLayoutV3Model.forward crates/koharu-ml/src/pp_doclayout_v3/model.rs:243 — MethodTooLong — forward runs 110 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 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TextLayout.append_balanced_segment_lines crates/koharu-renderer/src/layout.rs:955 — MethodTooLong — append_balanced_segment_lines runs 110 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 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PPDocLayoutV3ImageProcessor.postprocess_batch crates/koharu-ml/src/pp_doclayout_v3/processor.rs:128 — MethodTooLong — postprocess_batch runs 109 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 9 over it, 1.09× 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: Traversal.visit_children crates/koharu-renderer/src/renderer.rs:584 — MethodTooLong — visit_children runs 108 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 8 over it, 1.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.
  • MethodTooLong: Project.apply_raster_stroke crates/koharu-app/src/commands/project.rs:741 — MethodTooLong — apply_raster_stroke runs 101 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 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×19
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:158 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:158-166 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:184-192 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:346 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:346-354 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:394-402 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/paddle_ocr_vl/model.rs:969 — crates/koharu-ml/src/paddle_ocr_vl/model.rs:969-977 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:978-986 — both copies are in the same file, so extract the block into 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) crates/koharu-renderer/src/renderer.rs:724 — crates/koharu-renderer/src/renderer.rs:724-732 | crates/koharu-renderer/src/renderer.rs:943-951 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-renderer/src/renderer.rs:724` 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/koharu-runtime/src/runtime/packages/diffusion.rs:159 — crates/koharu-runtime/src/runtime/packages/diffusion.rs:159-167 | crates/koharu-runtime/src/runtime/packages/llama.rs:159-167 — before extracting anything, compare `crates/koharu-runtime/src/runtime/packages/diffusion.rs` and `crates/koharu-runtime/src/runtime/packages/llama.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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) crates/koharu-scene/src/state.rs:185 — crates/koharu-scene/src/state.rs:185-193 | crates/koharu-scene/src/state.rs:209-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn remove_leaf(&mut` in one and `&mut` 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 (9 lines × 2) crates/koharu-torch/src/nn/conv.rs:124 — crates/koharu-torch/src/nn/conv.rs:124-132 | crates/koharu-torch/src/nn/conv_transpose.rs:63-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/koharu-torch/src/tensor/npy.rs:187 — crates/koharu-torch/src/tensor/npy.rs:187-195 | crates/koharu-torch/src/tensor/npy.rs:210-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/aot_inpainting/processor.rs:101 — crates/koharu-ml/src/aot_inpainting/processor.rs:101-109 | crates/koharu-ml/src/rorem_mixed/processor.rs:138-146 — 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/koharu-ml/src/aot_inpainting/processor.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 (9 lines × 2) crates/koharu-ml/src/manga_ocr/model.rs:550 — crates/koharu-ml/src/manga_ocr/model.rs:550-558 | crates/koharu-ml/src/manga_ocr/model.rs:915-923 — both copies are in the same file, so extract the block into 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) crates/koharu-torch/src/vision/efficientnet.rs:114 — crates/koharu-torch/src/vision/efficientnet.rs:114-122 | crates/koharu-torch/src/vision/efficientnet.rs:361-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-torch/src/vision/efficientnet.rs:114` 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/koharu-ml/src/bin/comic_onomatopoeia.rs:221 — crates/koharu-ml/src/bin/comic_onomatopoeia.rs:221-229 | crates/koharu-ml/src/bin/pp_ocr_v6.rs:84-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `&impl Serialize` in one and `&impl serde::Serialize` 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 (9 lines × 2) crates/koharu-torch/src/vision/densenet.rs:10 — crates/koharu-torch/src/vision/densenet.rs:10-18 | crates/koharu-torch/src/vision/resnet.rs:7-15 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/lama/model.rs:332 — crates/koharu-ml/src/lama/model.rs:332-340 | crates/koharu-ml/src/lama/model.rs:341-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. 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) crates/koharu-translator/src/remote/lm_studio.rs:85 — crates/koharu-translator/src/remote/lm_studio.rs:85-93 | crates/koharu-translator/src/remote/openai_compatible.rs:85-93 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai_compatible.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/koharu-ml/src/lama/processor.rs:157 — crates/koharu-ml/src/lama/processor.rs:157-165 | crates/koharu-ml/src/lama/processor.rs:169-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/lama/processor.rs:157` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `image` to `&RgbImage` in one and `&GrayImage` 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 (9 lines × 2) crates/koharu-runtime/src/runtime/packages/diffusion.rs:100 — crates/koharu-runtime/src/runtime/packages/diffusion.rs:100-108 | crates/koharu-runtime/src/runtime/packages/llama.rs:100-108 — before extracting anything, compare `crates/koharu-runtime/src/runtime/packages/diffusion.rs` and `crates/koharu-runtime/src/runtime/packages/llama.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-runtime/src/runtime/packages/diffusion.rs:100` 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/koharu-ml/src/pp_ocr_v6/det/processor.rs:67 — crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:67-75 | crates/koharu-ml/src/pp_ocr_v6/rec/processor.rs:77-85 — 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) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:335 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:335-343 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:383-391 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:335` 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.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×17
  • Duplicated block (8 lines × 2) crates/koharu-llama/src/context/kv_cache.rs:60 — crates/koharu-llama/src/context/kv_cache.rs:60-67 | crates/koharu-llama/src/context/kv_cache.rs:146-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/koharu-llama/src/context/kv_cache.rs:60` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) crates/koharu-ml/src/aot_inpainting/processor.rs:136 — crates/koharu-ml/src/aot_inpainting/processor.rs:136-143 | crates/koharu-ml/src/rorem_mixed/processor.rs:164-171 — 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/koharu-ml/src/aot_inpainting/processor.rs:136` 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:320 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:320-327 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:264-271 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (8 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1738 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1738-1745 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2270-2277 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) crates/koharu-ml/src/comic_text_detector/processor.rs:1227 — crates/koharu-ml/src/comic_text_detector/processor.rs:1227-1234 | crates/koharu-ml/src/comic_text_detector/processor.rs:1248-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 `crates/koharu-ml/src/comic_text_detector/processor.rs:1227` 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/koharu-pipeline/src/stages/detection.rs:979 — crates/koharu-pipeline/src/stages/detection.rs:979-986 | crates/koharu-pipeline/src/stages/detection.rs:990-997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-pipeline/src/stages/detection.rs:979` 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:368 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:368-375 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:336-343 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1627 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1627-1634 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2131-2138 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1627` 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/koharu-ml/src/comic_layout_yolo26s/model.rs:358 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:358-365 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:326-333 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) crates/koharu-torch/src/nn/batch_norm.rs:46 — crates/koharu-torch/src/nn/batch_norm.rs:46-53 | crates/koharu-torch/src/nn/group_norm.rs:44-51 — 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) crates/koharu-ml/src/aot_inpainting/processor.rs:173 — crates/koharu-ml/src/aot_inpainting/processor.rs:173-180 | crates/koharu-ml/src/lama/processor.rs:330-337 — 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) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1570 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1570-1577 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2083-2090 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1579 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1579-1586 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2092-2099 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 2) crates/koharu-pipeline/src/resources/linux.rs:139 — crates/koharu-pipeline/src/resources/linux.rs:139-146 | crates/koharu-pipeline/src/resources/windows.rs:120-127 — 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) crates/koharu-translator/src/remote/lm_studio.rs:130 — crates/koharu-translator/src/remote/lm_studio.rs:130-137 | crates/koharu-translator/src/remote/openai_compatible.rs:127-134 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai_compatible.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) crates/koharu-torch/src/nn/optimizer.rs:363 — crates/koharu-torch/src/nn/optimizer.rs:363-370 | crates/koharu-torch/src/nn/var_store.rs:142-149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/koharu-canvas/src/web.rs:634 — crates/koharu-canvas/src/web.rs:634-641 | crates/koharu-canvas/src/web.rs:665-672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D15 · Churn × Complexity Hotspots · Repeated repair · ×15
  • Repeated repair: crates/koharu-runtime/src/runtime/packages/torch.rs crates/koharu-runtime/src/runtime/packages/torch.rs:116 — crates/koharu-runtime/src/runtime/packages/torch.rs changed 20 times in last 90 days and 13 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 Torch::discover at line 116), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): update Torch to v2.13.0.6”; “fix(runtime): update native dependencies”; “fix(runtime): update Torch to v2.13.0.3”; “fix(runtime): update Torch release”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-runtime/src/runtime/packages/torch.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/koharu-runtime/src/runtime/packages/rocm.rs crates/koharu-runtime/src/runtime/packages/rocm.rs:133 — crates/koharu-runtime/src/runtime/packages/rocm.rs changed 19 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is koharu_runtime::runtime::packages::rocm::wheel_platform at line 133), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): align ROCm targets with llama.cpp”; “fix(runtime): drop unsupported gfx1250”; “fix(runtime): use exact ROCm library paths”; “fix(runtime): update ROCm to 10.0”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-runtime/src/runtime/packages/rocm.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/koharu-translator/src/lib.rs crates/koharu-translator/src/lib.rs:99 — crates/koharu-translator/src/lib.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 5 (its worst body is Translator::translate at line 99), 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(translator): cache model-listing client with five-second timeout (#1103)”; “fix(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/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: crates/koharu-translator/src/remote/gemini.rs crates/koharu-translator/src/remote/gemini.rs:76 — crates/koharu-translator/src/remote/gemini.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 5 (its worst body is koharu_translator::remote::gemini::translate at line 76), 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(translator): map Gemini thinking controls”; “fix(translator): decode optional Gemini thinking capability”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/gemini.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: packages/koharu/components/preferences/TranslationPreferences.tsx packages/koharu/components/preferences/TranslationPreferences.tsx:32 — packages/koharu/components/preferences/TranslationPreferences.tsx 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 4 (its worst body is TranslationPreferences.TranslationPreferences at line 32), 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(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”; “fix(ui): gate vision by model capability”; “fix: refine provider and translation settings”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/components/preferences/TranslationPreferences.tsx`: 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/koharu-renderer/src/renderer.rs crates/koharu-renderer/src/renderer.rs:919 — crates/koharu-renderer/src/renderer.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is koharu_renderer::renderer::resolve_balloon_flows at line 919), 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(renderer): preserve joined balloon text placement”; “fix(canvas): preserve authored text rotation”; “fix(renderer): respect text direction defaults”; “fix: preserve canvas zoom and vertical text”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-renderer/src/renderer.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/koharu-translator/src/remote/lm_studio.rs crates/koharu-translator/src/remote/lm_studio.rs:33 — crates/koharu-translator/src/remote/lm_studio.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is koharu_translator::remote::lm_studio::translate at line 33), 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(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”; “fix(translator): use LM Studio vision capability”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/lm_studio.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/koharu-translator/src/remote/deepseek.rs crates/koharu-translator/src/remote/deepseek.rs:47 — crates/koharu-translator/src/remote/deepseek.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is koharu_translator::remote::deepseek::translate at line 47), 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(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/deepseek.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/koharu-translator/src/remote/openai.rs crates/koharu-translator/src/remote/openai.rs:46 — crates/koharu-translator/src/remote/openai.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is koharu_translator::remote::openai::supports_translation at line 46), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/openai.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/koharu-translator/src/remote/openai_compatible.rs crates/koharu-translator/src/remote/openai_compatible.rs:33 — crates/koharu-translator/src/remote/openai_compatible.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is koharu_translator::remote::openai_compatible::translate at line 33), 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(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/openai_compatible.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: packages/koharu/lib/translation.ts packages/koharu/lib/translation.ts:9 — packages/koharu/lib/translation.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is translation.providerName at line 9), 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(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”; “fix(ui): gate vision by model capability”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/lib/translation.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/koharu-translator/src/remote/openrouter.rs crates/koharu-translator/src/remote/openrouter.rs:100 — crates/koharu-translator/src/remote/openrouter.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is koharu_translator::remote::openrouter::models at line 100), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(translator): recover model responses the JSON repair layer rejects (#1022)”; “fix(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-translator/src/remote/openrouter.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/koharu-ml/src/backend.rs crates/koharu-ml/src/backend.rs:10 — crates/koharu-ml/src/backend.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is Device::try_into_device at line 10), 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: disable MIOpen on Windows”; “fix(ml): disable MIOpen on Windows gfx10”; “fix(ml): select precision by device capability”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-ml/src/backend.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: packages/koharu/components/preferences/GenerationPreferences.tsx packages/koharu/components/preferences/GenerationPreferences.tsx:13 — packages/koharu/components/preferences/GenerationPreferences.tsx changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is GenerationPreferences.GenerationPreferences at line 13), 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(translator): respect model capabilities”; “fix(translator): align reasoning capabilities”; “fix: refine provider and translation settings”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/components/preferences/GenerationPreferences.tsx`: 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: packages/koharu/components/app/WindowChrome.tsx packages/koharu/components/app/WindowChrome.tsx:32 — packages/koharu/components/app/WindowChrome.tsx 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 8 (its worst body is WindowChrome.WindowControls at line 32), 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(app): restore frameless window resizing”; “fix(macos): titlebar style”; “chore(dev): fix macos development”. 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/components/app/WindowChrome.tsx`: 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.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×15
  • Edited copy of a member (9 corresponding lines) crates/koharu-ml/src/pp_doclayout_v3/model.rs:496 — crates/koharu-ml/src/pp_doclayout_v3/model.rs:496-510 | crates/koharu-ml/src/pp_ocr_v6/pp_lcnet_v4.rs:540-548 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:367 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:367-375 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:335-343 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:357 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:357-365 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:325-333 — 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/koharu-torch/src/nn/var_store.rs:431 — crates/koharu-torch/src/nn/var_store.rs:431-439 | crates/koharu-torch/src/nn/var_store.rs:445-453 — 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/koharu-scene/src/snapshot.rs:156 — crates/koharu-scene/src/snapshot.rs:156-164 | crates/koharu-scene/src/snapshot.rs:170-178 — 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/koharu-pipeline/src/stages/detection.rs:1170 — crates/koharu-pipeline/src/stages/detection.rs:1170-1178 | crates/koharu-pipeline/src/stages/detection.rs:1258-1266 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:1737 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1737-1745 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2269-2277 — 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/koharu-ml/src/hayai_ocr/processor.rs:43 — crates/koharu-ml/src/hayai_ocr/processor.rs:43-51 | crates/koharu-ml/src/manga_text_mask/processor.rs:26-34 — 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/koharu-llama/src/model.rs:834 — crates/koharu-llama/src/model.rs:834-842 | crates/koharu-llama/src/model.rs:857-865 — 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/koharu-diffusion/src/image.rs:22 — crates/koharu-diffusion/src/image.rs:22-32 | crates/koharu-diffusion/src/image.rs:34-42 — 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/koharu-ml/src/paddle_ocr_vl/model.rs:535 — crates/koharu-ml/src/paddle_ocr_vl/model.rs:535-543 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:732-747 — 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/koharu-scene/src/snapshot.rs:45 — crates/koharu-scene/src/snapshot.rs:45-53 | crates/koharu-scene/src/snapshot.rs:66-75 — 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/koharu-rasterizer/src/frame.rs:143 — crates/koharu-rasterizer/src/frame.rs:143-151 | crates/koharu-renderer/src/frame.rs:224-232 — 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/koharu-torch/src/nn/group_norm.rs:17 — crates/koharu-torch/src/nn/group_norm.rs:17-25 | crates/koharu-torch/src/nn/layer_norm.rs:16-24 — 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/koharu-ml/src/flux2_klein/model.rs:42 — crates/koharu-ml/src/flux2_klein/model.rs:42-50 | crates/koharu-ml/src/rorem_mixed/model.rs:42-50 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×15
  • Duplicated block (5 lines × 2) crates/koharu-app/src/commands/agent/host.rs:37 — crates/koharu-app/src/commands/agent/host.rs:37-41 | crates/koharu-app/src/commands/agent/host.rs:242-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-app/src/commands/agent/host.rs:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:321 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:321-326 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:373-377 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:321` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:205 — crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:205-209 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:468-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:473` calls `forward` and `crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:210` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:992 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:992-996 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1116-1120 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:992` 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) crates/koharu-renderer/src/renderer.rs:723 — crates/koharu-renderer/src/renderer.rs:723-727 | crates/koharu-renderer/src/renderer.rs:1049-1053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-renderer/src/renderer.rs:723` 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 × 2) crates/koharu-torch/src/vision/rust_image.rs:96 — crates/koharu-torch/src/vision/rust_image.rs:96-100 | crates/koharu-torch/src/vision/rust_image.rs:108-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `rgb` to `&'i Rgb32FImage` in one and `&'i Rgba32FImage` 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 (5 lines × 2) crates/koharu-ml/src/baberu_ocr/model.rs:875 — crates/koharu-ml/src/baberu_ocr/model.rs:875-879 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:887-891 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/bin/comic_onomatopoeia.rs:124 — crates/koharu-ml/src/bin/comic_onomatopoeia.rs:124-128 | crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs:92-96 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:230 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:230-234 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:310-314 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:151 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:151-155 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:511-515 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:60 — crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:60-64 | crates/koharu-ml/src/pp_ocr_v6/rec/processor.rs:70-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/koharu-torch/src/wrappers/jit.rs:616 — crates/koharu-torch/src/wrappers/jit.rs:616-620 | crates/koharu-torch/src/wrappers/tensor.rs:565-569 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:163 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:163-167 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:204-208 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:163` 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) crates/koharu-ml/src/comic_text_detector/model.rs:762 — crates/koharu-ml/src/comic_text_detector/model.rs:762-766 | crates/koharu-ml/src/comic_text_detector/model.rs:792-796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_detector/model.rs:762` 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) crates/koharu-ml/src/comic_text_detector/processor.rs:861 — crates/koharu-ml/src/comic_text_detector/processor.rs:861-865 | crates/koharu-ml/src/comic_text_detector/processor.rs:868-872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · koharu_ml · ×13
  • koharu_ml::comic_text_detector::processor::rearranged_inference (cognitive 99) crates/koharu-ml/src/comic_text_detector/processor.rs:114 — koharu_ml::comic_text_detector::processor::rearranged_inference has cognitive complexity 99 (threshold 15). Drivers by points: loops 17 (58 pts), if/else 20 (39 pts), boolean chains 2 (nesting depth added 60). 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.
  • koharu_ml::comic_text_detector::processor::connected_components (cognitive 42) crates/koharu-ml/src/comic_text_detector/processor.rs:1128 — koharu_ml::comic_text_detector::processor::connected_components has cognitive complexity 42 (threshold 15). Drivers by points: if/else 4 (21 pts), loops 5 (15 pts), boolean chains 6 (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.
  • koharu_ml::bin::koharu_layout_rfdetr_seg_2xl::draw_detections (cognitive 32) crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs:98 — koharu_ml::bin::koharu_layout_rfdetr_seg_2xl::draw_detections 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.
  • koharu_ml::bin::comic_layout_yolo26s::annotated_image (cognitive 28) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:172 — koharu_ml::bin::comic_layout_yolo26s::annotated_image has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 5 (13 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::comic_onomatopoeia::detector::processor::fill_polygon (cognitive 22) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:500 — koharu_ml::comic_onomatopoeia::detector::processor::fill_polygon has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (10 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.
  • koharu_ml::comic_text_detector::processor::try_merge_text_line (cognitive 22) crates/koharu-ml/src/comic_text_detector/processor.rs:752 — koharu_ml::comic_text_detector::processor::try_merge_text_line has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::pp_ocr_v6::det::processor::opencv_fill_polygon (cognitive 22) crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:449 — koharu_ml::pp_ocr_v6::det::processor::opencv_fill_polygon has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (10 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.
  • koharu_ml::comic_text_detector::processor::sort_regions (cognitive 18) crates/koharu-ml/src/comic_text_detector/processor.rs:818 — koharu_ml::comic_text_detector::processor::sort_regions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::manga_text_mask::processor::fill_holes (cognitive 18) crates/koharu-ml/src/manga_text_mask/processor.rs:292 — koharu_ml::manga_text_mask::processor::fill_holes has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 4 (7 pts), boolean chains 2 (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.
  • koharu_ml::speech_bubble_yolov8m::processor::non_max_suppression (cognitive 18) crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:308 — koharu_ml::speech_bubble_yolov8m::processor::non_max_suppression has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::comic_onomatopoeia::detector::processor::draw_line_8_connected (cognitive 17) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:557 — koharu_ml::comic_onomatopoeia::detector::processor::draw_line_8_connected has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::pp_ocr_v6::det::processor::draw_line_8_connected (cognitive 17) crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:507 — koharu_ml::pp_ocr_v6::det::processor::draw_line_8_connected has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_ml::speech_bubble_yolo11n::processor::non_max_suppression (cognitive 17) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:304 — koharu_ml::speech_bubble_yolo11n::processor::non_max_suppression has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (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.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×11
  • Edited copy of a member (7 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:222 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:222-228 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:302-308 — 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/koharu-torch-sys/src/lib.rs:49 — crates/koharu-torch-sys/src/lib.rs:49-55 | crates/koharu-torch-sys/src/lib.rs:57-63 — 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/koharu-torch/src/nn/rnn.rs:182 — crates/koharu-torch/src/nn/rnn.rs:182-188 | crates/koharu-torch/src/nn/rnn.rs:272-280 — 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/koharu-diffusion/src/ffi.rs:45 — crates/koharu-diffusion/src/ffi.rs:45-53 | crates/koharu-diffusion/src/ffi.rs:59-65 — 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/koharu-pipeline/src/resources/vram.rs:157 — crates/koharu-pipeline/src/resources/vram.rs:157-163 | crates/koharu-pipeline/src/resources/windows.rs:104-110 — 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/koharu-torch/src/wrappers/jit.rs:469 — crates/koharu-torch/src/wrappers/jit.rs:469-475 | crates/koharu-torch/src/wrappers/jit.rs:484-494 — 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/koharu-ml/src/baberu_ocr/mod.rs:126 — crates/koharu-ml/src/baberu_ocr/mod.rs:126-138 | crates/koharu-ml/src/hayai_ocr/mod.rs:84-90 — 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/koharu-ml/src/comic_text_bubble_detector/processor.rs:438 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:438-445 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:304-310 — 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/koharu-ml/src/manga_ocr/mod.rs:77 — crates/koharu-ml/src/manga_ocr/mod.rs:77-83 | crates/koharu-ml/src/pp_ocr_v6/det/mod.rs:63-69 — 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/koharu-ml/src/lama/processor.rs:147 — crates/koharu-ml/src/lama/processor.rs:147-153 | crates/koharu-ml/src/manga_text_mask/processor.rs:249-255 — 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/koharu-ml/src/hayai_ocr/model.rs:414 — crates/koharu-ml/src/hayai_ocr/model.rs:414-420 | crates/koharu-ml/src/pp_ocr_v6/rec/model.rs:232-238 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×11
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:152 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:152-158 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:152-158 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:247 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:247-253 | crates/koharu-ml/src/comic_text_bubble_detector/model.rs:402-408 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:180 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:180-186 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:220-226 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:180` 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/koharu-ml/src/pp_ocr_v6/det/processor.rs:219` calls `take` and `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:179` 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) crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:74 — crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:74-80 | crates/koharu-ml/src/speech_bubble_yolov8m/mod.rs:74-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/koharu-torch/src/nn/var_store.rs:215 — crates/koharu-torch/src/nn/var_store.rs:215-221 | crates/koharu-torch/src/nn/var_store.rs:276-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-torch/src/nn/var_store.rs:215` 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/koharu-ml/src/comic_layout_yolo26s/model.rs:116 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:116-122 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:116-122 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:490 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:490-496 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:493-499 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/recognizer/mod.rs:53 — crates/koharu-ml/src/comic_onomatopoeia/recognizer/mod.rs:53-59 | crates/koharu-ml/src/pp_ocr_v6/rec/mod.rs:70-76 — 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) crates/koharu-ml/src/pp_doclayout_v3/processor.rs:100 — crates/koharu-ml/src/pp_doclayout_v3/processor.rs:100-106 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:95-102 — 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/koharu-ml/src/pp_doclayout_v3/processor.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 2) crates/koharu-ml/src/comic_text_detector/processor.rs:95 — crates/koharu-ml/src/comic_text_detector/processor.rs:95-101 | crates/koharu-ml/src/comic_text_detector/processor.rs:304-310 — both copies are in the same file, so extract the block into 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/koharu-ml/src/comic_layout_yolo26s/model.rs:612 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:612-618 | crates/koharu-ml/src/comic_layout_yolo26s/model.rs:626-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · koharu_renderer · ×10
  • koharu_renderer::layout::exact_profiled_line_breaks (cognitive 42) crates/koharu-renderer/src/layout.rs:1632 — koharu_renderer::layout::exact_profiled_line_breaks has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 4 (7 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. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • koharu_renderer::layout::optimal_uniform_line_breaks (cognitive 34) crates/koharu-renderer/src/layout.rs:1430 — koharu_renderer::layout::optimal_uniform_line_breaks has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • koharu_renderer::bubble::decompose_lobes (cognitive 33) crates/koharu-renderer/src/bubble.rs:116 — koharu_renderer::bubble::decompose_lobes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (7 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_renderer::renderer::resolve_balloon_flows (cognitive 32) crates/koharu-renderer/src/renderer.rs:919 — koharu_renderer::renderer::resolve_balloon_flows has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_renderer::bubble::anchor_flow_cells (cognitive 31) crates/koharu-renderer/src/bubble.rs:373 — koharu_renderer::bubble::anchor_flow_cells has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_renderer::shape::shape_script_runs (cognitive 22) crates/koharu-renderer/src/shape.rs:123 — koharu_renderer::shape::shape_script_runs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 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.
  • koharu_renderer::text_renderer::draw_layout (cognitive 20) crates/koharu-renderer/src/text_renderer.rs:367 — koharu_renderer::text_renderer::draw_layout has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • koharu_renderer::layout::largest_fitting_font_size (cognitive 19) crates/koharu-renderer/src/layout.rs:194 — koharu_renderer::layout::largest_fitting_font_size has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • koharu_renderer::bubble::geometry_frame (cognitive 18) crates/koharu-renderer/src/bubble.rs:643 — koharu_renderer::bubble::geometry_frame has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_renderer::layout::justify_lines (cognitive 18) crates/koharu-renderer/src/layout.rs:1362 — koharu_renderer::layout::justify_lines has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, 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. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D3 · God Classes · TooManyMethods · ×10
  • TooManyMethods: Tensor crates/koharu-torch/src/wrappers/tensor.rs:17 — TooManyMethods — 108 methods, declared across 9 files: wrappers/tensor.rs (71), tensor/mod.rs (22), tensor/npy.rs (5), nn/module.rs (4), +5 more file(s). The bar is 30 methods; this is 78 over it, 3.60× 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: LlamaContextParams crates/koharu-llama/src/context/params.rs:301 — 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: LlamaContext crates/koharu-llama/src/context.rs:26 — TooManyMethods — 46 methods, declared across 3 files: src/context.rs (21), context/session.rs (14), context/kv_cache.rs (11). The bar is 30 methods; this is 16 over it, 1.53× 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: Project crates/koharu-app/src/commands/project.rs:254 — 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: LlamaModel crates/koharu-llama/src/model.rs:26 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Edit crates/koharu-scene/src/edit.rs:31 — TooManyMethods — 44 methods, declared across 2 files: src/edit.rs (41), src/document.rs (3). The bar is 30 methods; this is 14 over it, 1.47× 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: Path crates/koharu-torch/src/nn/var_store.rs:39 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.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: Snapshot crates/koharu-scene/src/snapshot.rs:12 — TooManyMethods — 33 methods, declared across 2 files: src/snapshot.rs (28), src/document.rs (5). The bar is 30 methods; this is 3 over it, 1.10× 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: State crates/koharu-scene/src/state.rs:440 — 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.
  • TooManyMethods: LlamaSampler crates/koharu-llama/src/sampling.rs:15 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D30 · Dependency Vulnerabilities · Medium CVE · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · ClassTooLong · ×9
  • ClassTooLong: TextLayout crates/koharu-renderer/src/layout.rs:174 — ClassTooLong — 840 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 2 blocks, lines 174-1352. The bar is 400 significant lines; this is 440 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Project crates/koharu-app/src/commands/project.rs:254 — ClassTooLong — 773 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 45 methods, 2 blocks, lines 254-1238. The bar is 400 significant lines; this is 373 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CanvasWorkspace packages/koharu/components/editor/CanvasWorkspace.tsx:1 — ClassTooLong — 670 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods. The bar is 400 significant lines; this is 270 over it, 1.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Edit crates/koharu-scene/src/edit.rs:31 — ClassTooLong — 665 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 2 blocks, lines 31-905. The bar is 400 significant lines; this is 265 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GpuCompositor crates/koharu-rasterizer/src/compositor.rs:195 — ClassTooLong — 459 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 17 methods, 2 blocks, lines 195-789. The bar is 400 significant lines; this is 59 over it, 1.15× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LlamaModel crates/koharu-llama/src/model.rs:26 — ClassTooLong — 457 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 4 blocks, lines 26-1028. The bar is 400 significant lines; this is 57 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: WebCanvas crates/koharu-canvas/src/web.rs:1092 — ClassTooLong — 427 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, 4 blocks, lines 1092-1757. The bar is 400 significant lines; this is 27 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: State crates/koharu-scene/src/state.rs:440 — ClassTooLong — 417 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, 2 blocks, lines 440-967. The bar is 400 significant lines; this is 17 over it, 1.04× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Tensor crates/koharu-torch/src/wrappers/tensor.rs:17 — ClassTooLong — 404 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 108 methods, 6 blocks, lines 17-856. The bar is 400 significant lines; this is 4 over it, 1.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.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×9
  • Edited copy of a member (10 corresponding lines) crates/koharu-torch/src/vision/efficientnet.rs:111 — crates/koharu-torch/src/vision/efficientnet.rs:111-127 | crates/koharu-torch/src/vision/efficientnet.rs:357-375 — 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/koharu-ml/src/comic_onomatopoeia/detector/model.rs:225 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:225-234 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:567-577 — 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/koharu-scene/src/state.rs:344 — crates/koharu-scene/src/state.rs:344-353 | crates/koharu-scene/src/state.rs:355-365 — 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/koharu-rasterizer/src/frame.rs:33 — crates/koharu-rasterizer/src/frame.rs:33-42 | crates/koharu-renderer/src/frame.rs:40-51 — 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/koharu-renderer/src/bubble.rs:468 — crates/koharu-renderer/src/bubble.rs:468-480 | crates/koharu-renderer/src/bubble.rs:482-491 — 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/koharu-rasterizer/src/prepared.rs:244 — crates/koharu-rasterizer/src/prepared.rs:244-256 | crates/koharu-rasterizer/src/prepared.rs:292-301 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:537 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:537-546 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:526-535 — 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/koharu-ml/src/aot_inpainting/model.rs:104 — crates/koharu-ml/src/aot_inpainting/model.rs:104-113 | crates/koharu-ml/src/aot_inpainting/model.rs:153-163 — 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/koharu-torch/src/nn/group_norm.rs:62 — crates/koharu-torch/src/nn/group_norm.rs:62-71 | crates/koharu-torch/src/nn/layer_norm.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.
R4 · Test Coverage · No test reaches this file · ×9
  • No test reaches this file packages/koharu/components/editor/AgentPanel.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/components/editor/Editor.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/components/app/KoharuApp.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/components/editor/RightSidebar.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/app/global-error.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/app/layout.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/instrumentation-client.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/app/(app)/page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/koharu/app/(app)/layout.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D17 · Explicit Debt · TodoComment · ×8
  • TodoComment crates/koharu-torch/src/wrappers/jit.rs:29 — // Eq or Hash out of the box in rust. TODO: improve this? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/koharu-torch/src/vision/dinov2.rs:5 — // TODO: use swiglu. — 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 crates/koharu-torch/src/tensor/convert.rs:31 — // TODO: Try to remove this intermediary copy. — 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 crates/koharu-torch/src/tensor/convert.rs:51 — // TODO: Try to remove this intermediary copy. — 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 crates/koharu-llama/src/lib.rs:555 — // TODO: Reinitialize the state to support calling send_logs_to_tracing multiple times. — 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 crates/koharu-llama/src/log.rs:241 — // TODO: Support logging this to stdout directly via options? — 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 crates/koharu-llama/src/model.rs:236 — // TODO lsptrip None is acutally not quite the origignal behavior of this function, — 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 crates/koharu-llama/src/model.rs:261 — // TODO lsptrip None is acutally not quite the origignal behavior of this function, — 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.
D2 · Cognitive Complexity · koharu_pipeline · ×8
  • koharu_pipeline::stages::inpainting::prepare (cognitive 36) crates/koharu-pipeline/src/stages/inpainting.rs:430 — koharu_pipeline::stages::inpainting::prepare has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_pipeline::stages::detection::infer_outline (cognitive 32) crates/koharu-pipeline/src/stages/detection.rs:760 — koharu_pipeline::stages::detection::infer_outline has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_pipeline::stages::detection::enclosing_cluster_pixels (cognitive 22) crates/koharu-pipeline/src/stages/detection.rs:966 — koharu_pipeline::stages::detection::enclosing_cluster_pixels has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 2 (8 pts), boolean chains 2 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • koharu_pipeline::stages::detection::measured_stroke_width (cognitive 21) crates/koharu-pipeline/src/stages/detection.rs:1180 — koharu_pipeline::stages::detection::measured_stroke_width has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_pipeline::stages::detection::stamp_mask (cognitive 20) crates/koharu-pipeline/src/stages/detection.rs:1539 — koharu_pipeline::stages::detection::stamp_mask has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_pipeline::stages::detection::closed_mask_for (cognitive 19) crates/koharu-pipeline/src/stages/detection.rs:1461 — koharu_pipeline::stages::detection::closed_mask_for has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (9 pts), if/else 4 (8 pts), boolean chains 2 (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.
  • koharu_pipeline::stages::inpainting::inpaint_tiles (cognitive 18) crates/koharu-pipeline/src/stages/inpainting.rs:619 — koharu_pipeline::stages::inpainting::inpaint_tiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_pipeline::stages::inpainting::fill_uniform_regions (cognitive 17) crates/koharu-pipeline/src/stages/inpainting.rs:587 — koharu_pipeline::stages::inpainting::fill_uniform_regions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×8
  • Edited copy of a member (16 corresponding lines) crates/koharu-torch/src/vision/resnet.rs:27 — crates/koharu-torch/src/vision/resnet.rs:27-42 | crates/koharu-torch/src/vision/resnet.rs:108-129 — 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/koharu-ml/src/pp_ocr_v6/rec/model.rs:142 — crates/koharu-ml/src/pp_ocr_v6/rec/model.rs:142-166 | crates/koharu-torch/src/vision/dinov2.rs:43-58 — 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/koharu-torch/src/nn/sequential.rs:59 — crates/koharu-torch/src/nn/sequential.rs:59-74 | crates/koharu-torch/src/nn/sequential.rs:139-154 — 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/koharu-llama/src/model.rs:775 — crates/koharu-llama/src/model.rs:775-790 | crates/koharu-llama/src/model.rs:800-821 — 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/koharu-app/src/commands/editing.rs:230 — crates/koharu-app/src/commands/editing.rs:230-245 | crates/koharu-app/src/commands/lifecycle.rs:438-456 — 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/koharu-scene/src/edit.rs:286 — crates/koharu-scene/src/edit.rs:286-306 | crates/koharu-scene/src/edit.rs:496-511 — 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/koharu-pipeline/src/stages/inpainting.rs:812 — crates/koharu-pipeline/src/stages/inpainting.rs:812-827 | crates/koharu-renderer/src/bubble.rs:493-510 — 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/koharu-ml/src/comic_text_bubble_detector/processor.rs:33 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:33-48 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:35-50 — 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 · Duplicated block (11 lines × 2) · ×8
  • Duplicated block (11 lines × 2) crates/koharu-ml/src/aot_inpainting/processor.rs:31 — crates/koharu-ml/src/aot_inpainting/processor.rs:31-41 | crates/koharu-ml/src/lama/processor.rs:35-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/koharu-ml/src/bin/comic_text_detector.rs:47 — crates/koharu-ml/src/bin/comic_text_detector.rs:47-57 | crates/koharu-ml/src/bin/pp_doclayout_v3.rs:45-56 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/bin/comic_text_detector.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 (11 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:191 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:191-201 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:158-168 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:191` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `&RTDetrV2Config` in one and `&PPDocLayoutV3Config` 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 (11 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:48 — crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:48-58 | crates/koharu-ml/src/speech_bubble_yolov8m/mod.rs:48-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:48` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/koharu-scene/src/state.rs:56 — crates/koharu-scene/src/state.rs:56-66 | crates/koharu-scene/src/state.rs:426-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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/koharu-ml/src/bin/comic_layout_yolo26s.rs:160 — crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:160-170 | crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:71-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:160` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) crates/koharu-pipeline/src/stages/inpainting.rs:193 — crates/koharu-pipeline/src/stages/inpainting.rs:193-203 | crates/koharu-pipeline/src/stages/inpainting.rs:268-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-pipeline/src/stages/inpainting.rs:193` 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/koharu-translator/src/remote/deepseek.rs:26 — crates/koharu-translator/src/remote/deepseek.rs:26-36 | crates/koharu-translator/src/remote/minimax.rs:22-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 `crates/koharu-translator/src/remote/deepseek.rs:26` 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.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×7
  • Edited copy of a member (15 corresponding lines) crates/koharu-diffusion/src/image.rs:56 — crates/koharu-diffusion/src/image.rs:56-70 | crates/koharu-diffusion/src/image.rs:72-89 — 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) crates/koharu-app/src/commands/agent/host.rs:92 — crates/koharu-app/src/commands/agent/host.rs:92-109 | crates/koharu-app/src/commands/agent/host.rs:459-473 — 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) crates/koharu-torch/src/vision/inception.rs:4 — crates/koharu-torch/src/vision/inception.rs:4-19 | crates/koharu-torch/src/vision/inception.rs:21-35 — 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) crates/koharu-ml/src/comic_text_bubble_detector/config.rs:184 — crates/koharu-ml/src/comic_text_bubble_detector/config.rs:184-198 | crates/koharu-ml/src/pp_doclayout_v3/config.rs:213-227 — 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) crates/koharu-llama/src/context.rs:153 — crates/koharu-llama/src/context.rs:153-168 | crates/koharu-llama/src/context.rs:186-200 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/koharu-ml/src/paddle_ocr_vl/processor.rs:62 — crates/koharu-ml/src/paddle_ocr_vl/processor.rs:62-78 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:31-45 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) crates/koharu-ml/src/baberu_ocr/model.rs:285 — crates/koharu-ml/src/baberu_ocr/model.rs:285-299 | crates/koharu-ml/src/manga_ocr/model.rs:400-414 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×7
  • Edited copy of a member (8 corresponding lines) crates/koharu-ml/src/comic_text_detector/model.rs:759 — crates/koharu-ml/src/comic_text_detector/model.rs:759-766 | crates/koharu-ml/src/comic_text_detector/model.rs:789-796 — 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/koharu-torch/src/wrappers/jit.rs:684 — crates/koharu-torch/src/wrappers/jit.rs:684-691 | crates/koharu-torch/src/wrappers/jit.rs:697-704 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:115 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:115-122 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:115-122 — 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/koharu-ml/src/speech_bubble_yolo11n/model.rs:369 — crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:369-378 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:296-303 — 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/koharu-ml/src/comic_onomatopoeia/detector/model.rs:246 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:246-253 | crates/koharu-ml/src/comic_text_bubble_detector/model.rs:401-408 — 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/koharu-ml/src/speech_bubble_yolov8m/model.rs:186 — crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:186-194 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:239-246 — 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/koharu-scene/src/session.rs:42 — crates/koharu-scene/src/session.rs:42-52 | crates/koharu-scene/src/session.rs:60-67 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×7
  • Edited copy of a member (6 corresponding lines) crates/koharu-torch/src/wrappers/jit.rs:498 — crates/koharu-torch/src/wrappers/jit.rs:498-503 | crates/koharu-torch/src/wrappers/jit.rs:525-535 — 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/koharu-ml/src/baberu_ocr/model.rs:265 — crates/koharu-ml/src/baberu_ocr/model.rs:265-276 | crates/koharu-ml/src/manga_ocr/model.rs:385-390 — 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/koharu-torch/src/wrappers/tensor.rs:132 — crates/koharu-torch/src/wrappers/tensor.rs:132-137 | crates/koharu-torch/src/wrappers/tensor.rs:190-195 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:328 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:328-334 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:221-226 — 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/koharu-renderer/src/fonts.rs:1062 — crates/koharu-renderer/src/fonts.rs:1062-1067 | crates/koharu-renderer/src/images.rs:54-59 — 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/koharu-app/src/commands/output.rs:216 — crates/koharu-app/src/commands/output.rs:216-221 | crates/koharu-psd/src/document.rs:228-233 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:264 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:264-270 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:168-173 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×7
  • Duplicated block (10 lines × 2) crates/koharu-app/src/commands/canvas.rs:155 — crates/koharu-app/src/commands/canvas.rs:155-164 | crates/koharu-app/src/commands/canvas.rs:181-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-app/src/commands/canvas.rs:155` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) crates/koharu-ml/src/bin/comic_onomatopoeia.rs:186 — crates/koharu-ml/src/bin/comic_onomatopoeia.rs:186-195 | crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs:172-181 — 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/koharu-ml/src/bin/comic_onomatopoeia.rs:186` 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) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1608 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1608-1617 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2119-2128 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) crates/koharu-torch/src/wrappers/tensor.rs:587 — crates/koharu-torch/src/wrappers/tensor.rs:587-596 | crates/koharu-torch/src/wrappers/tensor.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/koharu-torch/src/wrappers/tensor.rs:586` calls `path_to_cstring` and `crates/koharu-torch/src/wrappers/tensor.rs:612` 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/koharu-diffusion/src/params.rs:838 — crates/koharu-diffusion/src/params.rs:838-847 | crates/koharu-diffusion/src/params.rs:1055-1064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-diffusion/src/params.rs:838` 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:140 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:140-149 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:140-149 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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) crates/koharu-ml/src/aot_inpainting/mod.rs:27 — crates/koharu-ml/src/aot_inpainting/mod.rs:27-36 | crates/koharu-ml/src/manga_text_mask/mod.rs:27-36 — 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/koharu-ml/src/aot_inpainting/mod.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.
D5 · Coupling · Off the main sequence · ×7
  • Off the main sequence: @koharu/ui — @koharu/ui: 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: koharu-bindgen — koharu-bindgen: 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: koharu-config — koharu-config: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
  • Off the main sequence: koharu-rasterizer — koharu-rasterizer: 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: koharu-secrets — koharu-secrets: 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: koharu-storage — koharu-storage: 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: koharu-scene — koharu-scene: abstractness 0.05, instability 0.17, distance 0.78 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
D2 · Cognitive Complexity · TextLayout · ×6
  • TextLayout::run_with_size (cognitive 157) crates/koharu-renderer/src/layout.rs:463 — TextLayout::run_with_size has cognitive complexity 157 (threshold 15). Drivers by points: if/else 55 (112 pts), loops 12 (33 pts), boolean chains 6, match/switch 2 (6 pts) (nesting depth added 82). To reduce it, split the body into named stages: move each independent 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 file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • TextLayout::shaped_block_extents (cognitive 32) crates/koharu-renderer/src/layout.rs:896 — TextLayout::shaped_block_extents has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 3 (6 pts), match/switch 1 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • TextLayout::layout_cjk_emphasis_runs (cognitive 31) crates/koharu-renderer/src/layout.rs:1240 — TextLayout::layout_cjk_emphasis_runs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • TextLayout::append_balanced_segment_lines (cognitive 23) crates/koharu-renderer/src/layout.rs:955 — TextLayout::append_balanced_segment_lines has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • TextLayout::ink_bounds (cognitive 20) crates/koharu-renderer/src/layout.rs:1139 — TextLayout::ink_bounds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • TextLayout::run_auto (cognitive 18) crates/koharu-renderer/src/layout.rs:372 — TextLayout::run_auto has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/koharu-renderer/src/layout.rs holds 10 of the 89 functions over the threshold — including the worst — and 244 of the 959 points over it (25%), 2× the next-largest file (crates/koharu-ml/src/comic_text_detector/processor.rs at 121). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/aot_inpainting/processor.rs:196 — crates/koharu-ml/src/aot_inpainting/processor.rs:196-208 | crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:372-384 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:432-444 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:434-447 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:175 — crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:175-232 | crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs:103-194 | crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:86-102 | crates/koharu-ml/src/bin/speech_bubble_yolov8m.rs:85-101 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:386 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:386-395 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:334-343 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:446-455 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:449-458 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:397 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:397-406 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:356-365 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:457-466 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:460-469 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-ml/src/flux2_klein/mod.rs:156 — crates/koharu-ml/src/flux2_klein/mod.rs:156-290 | crates/koharu-ml/src/flux2_klein/processor.rs:70-88 | crates/koharu-ml/src/flux2_klein/processor.rs:165-197 | crates/koharu-translator/src/backend.rs:65-91 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/koharu-scene/src/edit.rs:94 — crates/koharu-scene/src/edit.rs:94-121 | crates/koharu-scene/src/edit.rs:139-200 | crates/koharu-scene/src/edit.rs:202-269 | crates/koharu-scene/src/edit.rs:696-747 — 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 (13 corresponding lines) · ×6
  • Edited copy of a member (13 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:661 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:661-678 | crates/koharu-ml/src/lama/model.rs:426-438 — 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/koharu-torch/src/nn/conv.rs:157 — crates/koharu-torch/src/nn/conv.rs:157-169 | crates/koharu-torch/src/nn/conv_transpose.rs:84-96 — 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/koharu/src/tracing.rs:42 — crates/koharu/src/tracing.rs:42-54 | crates/koharu/src/tracing.rs:55-67 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) crates/koharu-llama/src/context.rs:100 — crates/koharu-llama/src/context.rs:100-112 | crates/koharu-llama/src/context.rs:123-135 — 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/koharu-torch-sys/src/io.rs:40 — crates/koharu-torch-sys/src/io.rs:40-52 | crates/koharu-torch-sys/src/io.rs:109-121 — 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/koharu-pipeline/src/scope.rs:24 — crates/koharu-pipeline/src/scope.rs:24-36 | crates/koharu-scene/src/components/structure.rs:54-66 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×6
  • Duplicated block (16 lines × 2) crates/koharu-llama/src/sampling.rs:320 — crates/koharu-llama/src/sampling.rs:320-335 | crates/koharu-llama/src/sampling.rs:358-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-llama/src/sampling.rs:320` 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/koharu-ml/src/comic_layout_yolo26s/model.rs:473 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:473-488 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:476-491 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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/koharu-ml/src/comic_text_bubble_detector/config.rs:85 — crates/koharu-ml/src/comic_text_bubble_detector/config.rs:85-100 | crates/koharu-ml/src/pp_doclayout_v3/config.rs:72-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1227 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1227-1242 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1389-1404 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1227` 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/koharu-ml/src/flux2_klein/mod.rs:40 — crates/koharu-ml/src/flux2_klein/mod.rs:40-55 | crates/koharu-ml/src/flux2_klein/mod.rs:132-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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/koharu-rasterizer/src/native.rs:293 — crates/koharu-rasterizer/src/native.rs:293-308 | crates/koharu-rasterizer/src/native.rs:353-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-rasterizer/src/native.rs:293` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×6
  • Duplicated block (14 lines × 2) crates/koharu-ml/src/bin/comic_onomatopoeia.rs:135 — crates/koharu-ml/src/bin/comic_onomatopoeia.rs:135-148 | crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:212-225 — 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/koharu-ml/src/bin/comic_onomatopoeia.rs:135` 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) crates/koharu-renderer/src/renderer.rs:851 — crates/koharu-renderer/src/renderer.rs:851-864 | crates/koharu-renderer/src/renderer.rs:878-891 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-renderer/src/renderer.rs:851` 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, `crates/koharu-renderer/src/renderer.rs:892` calls `Some`, `contour` and `crates/koharu-renderer/src/renderer.rs:865` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) crates/koharu-torch/src/vision/resnet.rs:67 — crates/koharu-torch/src/vision/resnet.rs:67-80 | crates/koharu-torch/src/vision/resnet.rs:160-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-torch/src/vision/resnet.rs:67` 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) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:357 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:357-370 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:405-418 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:357` 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) crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:782 — crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:782-795 | crates/koharu-ml/src/pp_ocr_v6/det/model.rs:73-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:782` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) crates/koharu-canvas/src/web.rs:1844 — crates/koharu-canvas/src/web.rs:1844-1857 | crates/koharu-desktop/src/lib.rs:512-525 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×6
  • Duplicated block (12 lines × 2) crates/koharu-ml/src/baberu_ocr/model.rs:435 — crates/koharu-ml/src/baberu_ocr/model.rs:435-446 | crates/koharu-ml/src/hayai_ocr/model.rs:468-479 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:444 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:444-455 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:447-458 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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/koharu-ml/src/rorem_mixed/processor.rs:86 — crates/koharu-ml/src/rorem_mixed/processor.rs:86-97 | crates/koharu-ml/src/rorem_mixed/processor.rs:150-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/rorem_mixed/processor.rs:86` 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/koharu-rasterizer/src/native.rs:177 — crates/koharu-rasterizer/src/native.rs:177-188 | crates/koharu-rasterizer/src/native.rs:232-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-rasterizer/src/native.rs:177` 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) crates/koharu-ml/src/manga_ocr/model.rs:464 — crates/koharu-ml/src/manga_ocr/model.rs:464-475 | crates/koharu-ml/src/manga_ocr/model.rs:761-772 — both copies are in the same file, so extract the 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 `config` to `&ViTConfig` in one and `&BertConfig` 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/koharu-ml/src/comic_text_bubble_detector/model.rs:1547 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1547-1558 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2060-2071 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×5
  • Edited copy of a member (11 corresponding lines) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:420 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:420-430 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:422-432 — 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/koharu-ml/src/pp_ocr_v6/det/model.rs:26 — crates/koharu-ml/src/pp_ocr_v6/det/model.rs:26-42 | crates/koharu-ml/src/pp_ocr_v6/rec/model.rs:25-35 — 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/koharu-ml/src/baberu_ocr/model.rs:848 — crates/koharu-ml/src/baberu_ocr/model.rs:848-873 | crates/koharu-ml/src/hayai_ocr/model.rs:772-782 — 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/koharu-torch/src/nn/sequential.rs:29 — crates/koharu-torch/src/nn/sequential.rs:29-39 | crates/koharu-torch/src/nn/sequential.rs:101-111 — 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/koharu-ml/src/manga_ocr/model.rs:338 — crates/koharu-ml/src/manga_ocr/model.rs:338-349 | crates/koharu-ml/src/baberu_ocr/model.rs:183-193 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×5
  • Edited copy of a member (30 corresponding lines) crates/koharu-torch/src/vision/inception.rs:73 — crates/koharu-torch/src/vision/inception.rs:73-102 | crates/koharu-torch/src/vision/inception.rs:125-154 — 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) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1672 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1672-1707 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2159-2188 — 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) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:399 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:399-428 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:343-372 — 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) crates/koharu-ml/src/baberu_ocr/model.rs:431 — crates/koharu-ml/src/baberu_ocr/model.rs:431-460 | crates/koharu-ml/src/hayai_ocr/model.rs:465-494 — 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) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1408 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1408-1437 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1786-1827 — 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 (20 corresponding lines) · ×5
  • Edited copy of a member (20 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:320 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:320-343 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:372-391 — 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:289 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:289-310 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:184-203 — 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) crates/koharu-ml/src/comic_text_detector/processor.rs:1226 — crates/koharu-ml/src/comic_text_detector/processor.rs:1226-1245 | crates/koharu-ml/src/comic_text_detector/processor.rs:1247-1267 — 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) crates/koharu-ml/src/paddle_ocr_vl/model.rs:514 — crates/koharu-ml/src/paddle_ocr_vl/model.rs:514-533 | crates/koharu-ml/src/pp_ocr_v6/rec/model.rs:211-230 — 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) crates/koharu-ml/src/aot_inpainting/model.rs:83 — crates/koharu-ml/src/aot_inpainting/model.rs:83-102 | crates/koharu-ml/src/aot_inpainting/model.rs:131-151 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×5
  • Edited copy of a member (26 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:345 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:345-370 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:389-420 — 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/koharu-llama/src/sampling.rs:310 — crates/koharu-llama/src/sampling.rs:310-335 | crates/koharu-llama/src/sampling.rs:348-373 — 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/koharu-torch/src/nn/rnn.rs:152 — crates/koharu-torch/src/nn/rnn.rs:152-177 | crates/koharu-torch/src/nn/rnn.rs:242-267 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:1456 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1456-1481 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1851-1876 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:896 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:896-921 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1021-1047 — 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 (12 corresponding lines) · ×5
  • Edited copy of a member (12 corresponding lines) crates/koharu-ml/src/bin/aot_inpainting.rs:26 — crates/koharu-ml/src/bin/aot_inpainting.rs:26-37 | crates/koharu-ml/src/bin/lama.rs:23-36 — 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/koharu-app/src/commands/project.rs:863 — crates/koharu-app/src/commands/project.rs:863-874 | crates/koharu-app/src/commands/project.rs:876-887 — 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/koharu-llama/src/model/params.rs:50 — crates/koharu-llama/src/model/params.rs:50-61 | crates/koharu-llama/src/model/params.rs:71-84 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:851 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:851-862 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:976-987 — 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/koharu-translator/src/remote/claude.rs:132 — crates/koharu-translator/src/remote/claude.rs:132-147 | crates/koharu-translator/src/remote/gemini.rs:149-160 — 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 · Duplicated block (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) crates/koharu-llama/src/context/session.rs:205 — crates/koharu-llama/src/context/session.rs:205-212 | crates/koharu-llama/src/context/session.rs:303-310 | crates/koharu-llama/src/context/session.rs:412-419 — 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/koharu-llama/src/context/session.rs:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) crates/koharu-ml/src/aot_inpainting/processor.rs:121 — crates/koharu-ml/src/aot_inpainting/processor.rs:121-128 | crates/koharu-ml/src/rorem_mixed/processor.rs:85-92 | crates/koharu-ml/src/rorem_mixed/processor.rs:149-156 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/aot_inpainting/processor.rs:121` 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 × 3) crates/koharu-ml/src/manga_ocr/processor.rs:59 — crates/koharu-ml/src/manga_ocr/processor.rs:59-66 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:102-109 | crates/koharu-ml/src/pp_ocr_v6/rec/processor.rs:121-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/manga_ocr/processor.rs:59` 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/koharu-ml/src/pp_ocr_v6/det/processor.rs:111` calls `flip` and `crates/koharu-ml/src/manga_ocr/processor.rs:67` 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) crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:518 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:518-525 | crates/koharu-pipeline/src/stages/detection.rs:1590-1597 | crates/koharu-pipeline/src/stages/inpainting.rs:713-720 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) crates/koharu-pipeline/src/stages/inpainting.rs:193 — crates/koharu-pipeline/src/stages/inpainting.rs:193-202 | crates/koharu-pipeline/src/stages/inpainting.rs:218-225 | crates/koharu-pipeline/src/stages/inpainting.rs:268-277 — 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/koharu-pipeline/src/stages/inpainting.rs:193` 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×5
  • Duplicated block (5 lines × 3) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:402 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:402-406 | crates/koharu-ml/src/comic_text_detector/processor.rs:502-507 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:346-350 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/comic_text_detector/processor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/koharu-ml/src/flux2_klein/mod.rs:81 — crates/koharu-ml/src/flux2_klein/mod.rs:81-85 | crates/koharu-ml/src/flux2_klein/mod.rs:180-184 | crates/koharu-ml/src/flux2_klein/mod.rs:233-238 — 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/koharu-ml/src/flux2_klein/mod.rs:81` 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 × 3) crates/koharu-torch/src/wrappers/jit.rs:543 — crates/koharu-torch/src/wrappers/jit.rs:543-547 | crates/koharu-torch/src/wrappers/jit.rs:566-570 | crates/koharu-torch/src/wrappers/jit.rs:852-856 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/koharu-pipeline/src/stages/detection.rs:120 — crates/koharu-pipeline/src/stages/detection.rs:120-124 | crates/koharu-pipeline/src/stages/inpainting.rs:127-131 | crates/koharu-pipeline/src/stages/ocr.rs:50-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (5 lines × 3) crates/koharu-scene/src/edit.rs:427 — crates/koharu-scene/src/edit.rs:427-431 | crates/koharu-scene/src/edit.rs:535-539 | crates/koharu-scene/src/edit.rs:750-754 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn ensure_text_group(&mut` 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.
D2 · Cognitive Complexity · Model · ×4
  • Model::get_rope_index (cognitive 24) crates/koharu-ml/src/paddle_ocr_vl/model.rs:237 — Model::get_rope_index has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (20 pts), if/else 3 (4 pts) (nesting depth added 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Model::run (cognitive 20) crates/koharu-pipeline/src/stages/inpainting.rs:177 — Model::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, 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.
  • Model::beam_search (cognitive 19) crates/koharu-ml/src/manga_ocr/model.rs:81 — Model::beam_search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Model::run (cognitive 17) crates/koharu-pipeline/src/stages/ocr.rs:92 — Model::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 pts), match/switch 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.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×4
  • Edited copy of a member (24 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:330 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:330-353 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:274-297 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/koharu-canvas/src/web.rs:1843 — crates/koharu-canvas/src/web.rs:1843-1866 | crates/koharu-desktop/src/lib.rs:511-534 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1076 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1076-1099 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1230-1256 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) crates/koharu-ml/src/lama/model.rs:180 — crates/koharu-ml/src/lama/model.rs:180-203 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:718-741 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×4
  • Edited copy of a member (23 corresponding lines) crates/koharu-ml/src/bin/comic_text_bubble_detector.rs:28 — crates/koharu-ml/src/bin/comic_text_bubble_detector.rs:28-50 | crates/koharu-ml/src/bin/pp_doclayout_v3.rs:31-56 — 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/koharu-llama/src/mtmd.rs:479 — crates/koharu-llama/src/mtmd.rs:479-501 | crates/koharu-llama/src/mtmd.rs:532-554 — 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/koharu-torch/src/nn/var_store.rs:487 — crates/koharu-torch/src/nn/var_store.rs:487-511 | crates/koharu-torch/src/nn/var_store.rs:519-541 — 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/koharu-ml/src/manga_ocr/model.rs:461 — crates/koharu-ml/src/manga_ocr/model.rs:461-487 | crates/koharu-ml/src/manga_ocr/model.rs:757-779 — 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 copies of one member (3 members, 9+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 9+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:319 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:319-327 | crates/koharu-ml/src/comic_text_detector/processor.rs:387-395 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:263-271 — 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) crates/koharu-ml/src/baberu_ocr/model.rs:896 — crates/koharu-ml/src/baberu_ocr/model.rs:896-904 | crates/koharu-ml/src/hayai_ocr/model.rs:803-811 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:908-916 — 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) crates/koharu-diffusion/src/callbacks.rs:196 — crates/koharu-diffusion/src/callbacks.rs:196-204 | crates/koharu-diffusion/src/callbacks.rs:232-240 | crates/koharu-diffusion/src/callbacks.rs:305-315 — 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) crates/koharu-pipeline/src/stages/detection.rs:126 — crates/koharu-pipeline/src/stages/detection.rs:126-134 | crates/koharu-pipeline/src/stages/inpainting.rs:133-141 | crates/koharu-pipeline/src/stages/ocr.rs:56-64 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 3+ corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:531 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:531-534 | crates/koharu-ml/src/comic_text_detector/processor.rs:1363-1365 | crates/koharu-pipeline/src/stages/detection.rs:1824-1827 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:430 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:430-432 | crates/koharu-ml/src/comic_text_detector/processor.rs:531-533 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:374-376 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:336 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:336-338 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:228-230 | crates/koharu-torch/src/vision/squeezenet.rs:5-7 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) crates/koharu-torch/src/tensor/mod.rs:218 — crates/koharu-torch/src/tensor/mod.rs:218-220 | crates/koharu-torch/src/vision/alexnet.rs:14-16 | crates/koharu-torch/src/vision/inception.rs:37-39 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×4
  • Edited copy of a member (4 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:806 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:806-809 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:701-704 — 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/koharu-ml/src/comic_layout_yolo26s/model.rs:101 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:101-104 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:101-104 — 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/koharu-torch/src/vision/cifar.rs:37 — crates/koharu-torch/src/vision/cifar.rs:37-40 | crates/koharu-torch/src/vision/mnist.rs:53-56 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:1350 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1350-1353 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1568-1571 — 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.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×4
  • Duplicated block (24 lines × 2) crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:41 — crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:41-64 | crates/koharu-ml/src/bin/speech_bubble_yolov8m.rs:42-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:41` 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 (24 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:68 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:68-91 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:68-91 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (24 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1508 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1508-1531 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1903-1926 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (24 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:127 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:127-150 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:120-143 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:127` 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.
D1 · Cyclomatic Complexity · koharu_renderer · ×3
  • koharu_renderer::bubble::decompose_lobes (cyclomatic 19) crates/koharu-renderer/src/bubble.rs:116 — koharu_renderer::bubble::decompose_lobes 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.
  • koharu_renderer::layout::optimal_uniform_line_breaks (cyclomatic 19) crates/koharu-renderer/src/layout.rs:1430 — koharu_renderer::layout::optimal_uniform_line_breaks 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.
  • koharu_renderer::layout::exact_profiled_line_breaks (cyclomatic 19) crates/koharu-renderer/src/layout.rs:1632 — koharu_renderer::layout::exact_profiled_line_breaks 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×3
  • Hotspot: packages/koharu/components/editor/CanvasWorkspace.tsx packages/koharu/components/editor/CanvasWorkspace.tsx:91 — packages/koharu/components/editor/CanvasWorkspace.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 148 in CanvasWorkspace.CanvasWorkspace at line 91. 2 of those changes were fix/bug commits, and the other 3 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/components/editor/CanvasWorkspace.tsx`: 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: packages/koharu/components/editor/InferenceControl.tsx packages/koharu/components/editor/InferenceControl.tsx:86 — packages/koharu/components/editor/InferenceControl.tsx changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in InferenceControl.RuntimeSelector at line 86. 5 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- packages/koharu/components/editor/InferenceControl.tsx`: 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/koharu-rasterizer/src/compositor.rs crates/koharu-rasterizer/src/compositor.rs:453 — crates/koharu-rasterizer/src/compositor.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in GpuCompositor::render at line 453. 1 of those changes was a fix/bug commit, and the other 2 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-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 19:51:25 +00:00' --until='2026-11-13 19:51:25 +00:00' --full-history --no-merges -- crates/koharu-rasterizer/src/compositor.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.
D3 · God Classes · TooManyFields · ×3
  • TooManyFields: RTDetrV2Config crates/koharu-ml/src/comic_text_bubble_detector/config.rs:12 — TooManyFields — 56 stored fields beside 1 method. The bar is 30 stored fields; this is 26 over it, 1.87× 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: ContextParams crates/koharu-diffusion/src/params.rs:74 — TooManyFields — 54 stored fields beside 1 method. The bar is 30 stored fields; this is 24 over it, 1.80× 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: PPDocLayoutV3Config crates/koharu-ml/src/pp_doclayout_v3/config.rs:13 — TooManyFields — 45 stored fields beside 3 methods. The bar is 30 stored fields; this is 15 over it, 1.50× 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 (34 corresponding lines) · ×3
  • Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:807 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:807-840 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:918-965 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1149 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1149-1182 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1319-1352 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1034 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1034-1067 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1192-1228 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×3
  • Edited copy of a member (22 corresponding lines) crates/koharu-torch/src/vision/resnet.rs:59 — crates/koharu-torch/src/vision/resnet.rs:59-80 | crates/koharu-torch/src/vision/resnet.rs:152-173 — 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) crates/koharu-renderer/src/renderer.rs:849 — crates/koharu-renderer/src/renderer.rs:849-870 | crates/koharu-renderer/src/renderer.rs:876-897 — 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) crates/koharu-ml/src/comic_text_detector/mod.rs:30 — crates/koharu-ml/src/comic_text_detector/mod.rs:30-51 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/mod.rs:41-62 — 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 (19 corresponding lines) · ×3
  • Edited copy of a member (19 corresponding lines) crates/koharu-torch/src/wrappers/tensor.rs:585 — crates/koharu-torch/src/wrappers/tensor.rs:585-604 | crates/koharu-torch/src/wrappers/tensor.rs:612-630 — 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/koharu-app/src/commands/project.rs:479 — crates/koharu-app/src/commands/project.rs:479-497 | crates/koharu-app/src/commands/project.rs:503-524 — 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/koharu-scene/src/schema.rs:191 — crates/koharu-scene/src/schema.rs:191-211 | crates/koharu-scene/src/schema.rs:217-235 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×3
  • Edited copy of a member (17 corresponding lines) crates/koharu-torch/src/nn/var_store.rs:212 — crates/koharu-torch/src/nn/var_store.rs:212-230 | crates/koharu-torch/src/nn/var_store.rs:272-288 — 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) crates/koharu-diffusion/src/context.rs:92 — crates/koharu-diffusion/src/context.rs:92-108 | crates/koharu-diffusion/src/upscaler.rs:95-118 — 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) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:131 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:131-149 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:493-509 — 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 (14 corresponding lines) · ×3
  • Edited copy of a member (14 corresponding lines) crates/koharu-ml/src/rorem_mixed/processor.rs:84 — crates/koharu-ml/src/rorem_mixed/processor.rs:84-97 | crates/koharu-ml/src/rorem_mixed/processor.rs:148-161 — 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/koharu-scene/src/components/text.rs:21 — crates/koharu-scene/src/components/text.rs:21-34 | crates/koharu-scene/src/id.rs:104-118 — 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/koharu-ml/src/comic_text_bubble_detector/model.rs:965 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:965-978 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1094-1108 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:312 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:312-318 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:205-211 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:222-228 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:32 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:32-38 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:32-38 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:29-35 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:447 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:447-456 | crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:458-467 | crates/koharu-ml/src/manga_ocr/model.rs:301-307 — 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 · Duplicated block (20 lines × 2) · ×3
  • Duplicated block (20 lines × 2) crates/koharu-app/src/commands/import/rar.rs:46 — crates/koharu-app/src/commands/import/rar.rs:46-65 | crates/koharu-app/src/commands/import/zip.rs:33-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (20 lines × 2) crates/koharu-llama/src/context/session.rs:214 — crates/koharu-llama/src/context/session.rs:214-233 | crates/koharu-llama/src/context/session.rs:312-331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-llama/src/context/session.rs:214` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:334 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:334-353 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:278-297 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:334` 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.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×3
  • Duplicated block (18 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1369 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1369-1386 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1587-1604 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (18 lines × 2) crates/koharu-ml/src/paddle_ocr_vl/model.rs:143 — crates/koharu-ml/src/paddle_ocr_vl/model.rs:143-160 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:198-215 — both copies are in the same file, so extract the block into 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) crates/koharu-torch/src/nn/rnn.rs:153 — crates/koharu-torch/src/nn/rnn.rs:153-170 | crates/koharu-torch/src/nn/rnn.rs:243-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×3
  • Duplicated block (17 lines × 2) crates/koharu-llama/src/mtmd.rs:485 — crates/koharu-llama/src/mtmd.rs:485-501 | crates/koharu-llama/src/mtmd.rs:538-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-llama/src/mtmd.rs:485` 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) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:325 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:325-341 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:332-348 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:325` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1332 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1332-1348 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1550-1566 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1332` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×3
  • Duplicated block (15 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1714 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1714-1728 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2195-2209 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (15 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:111 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:111-125 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:104-118 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:111` 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/koharu-ml/src/speech_bubble_yolo11n/model.rs:353 — crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:353-367 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:280-294 — `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 32 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:387 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:387-395 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:335-343 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:447-455 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:450-458 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 4) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:398 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:398-406 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:357-365 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:458-466 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:461-469 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 × 4) crates/koharu-pipeline/src/stages/inpainting.rs:191 — crates/koharu-pipeline/src/stages/inpainting.rs:191-199 | crates/koharu-pipeline/src/stages/inpainting.rs:216-224 | crates/koharu-pipeline/src/stages/inpainting.rs:238-246 | crates/koharu-pipeline/src/stages/inpainting.rs:266-274 — 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/koharu-pipeline/src/stages/inpainting.rs:191` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) crates/koharu-app/src/commands/editing.rs:47 — crates/koharu-app/src/commands/editing.rs:47-53 | crates/koharu-app/src/commands/editing.rs:110-116 | crates/koharu-app/src/commands/editing.rs:131-137 — 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/koharu-app/src/commands/editing.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 (7 lines × 3) crates/koharu-canvas/src/web.rs:77 — crates/koharu-canvas/src/web.rs:77-83 | crates/koharu-desktop/src/lib.rs:24-30 | crates/koharu-rasterizer/src/prepared.rs:495-501 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) crates/koharu-ml/src/baberu_ocr/model.rs:315 — crates/koharu-ml/src/baberu_ocr/model.rs:315-321 | crates/koharu-ml/src/manga_ocr/model.rs:434-440 | crates/koharu-ml/src/manga_ocr/model.rs:710-716 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `&Dinov2Config` in one and `&ViTConfig` 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.
D1 · Cyclomatic Complexity · TextLayout · ×2
  • TextLayout::run_with_size (cyclomatic 58) crates/koharu-renderer/src/layout.rs:463 — TextLayout::run_with_size has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextLayout::append_balanced_segment_lines (cyclomatic 16) crates/koharu-renderer/src/layout.rs:955 — TextLayout::append_balanced_segment_lines 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.
D1 · Cyclomatic Complexity · koharu_ml · ×2
  • koharu_ml::comic_text_detector::processor::rearranged_inference (cyclomatic 33) crates/koharu-ml/src/comic_text_detector/processor.rs:114 — koharu_ml::comic_text_detector::processor::rearranged_inference has cyclomatic complexity 33 (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.
  • koharu_ml::comic_text_detector::processor::connected_components (cyclomatic 16) crates/koharu-ml/src/comic_text_detector/processor.rs:1128 — koharu_ml::comic_text_detector::processor::connected_components 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.
D1 · Cyclomatic Complexity · koharu_pipeline · ×2
  • koharu_pipeline::stages::detection::infer_outline (cyclomatic 16) crates/koharu-pipeline/src/stages/detection.rs:760 — koharu_pipeline::stages::detection::infer_outline 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.
  • koharu_pipeline::stages::inpainting::prepare (cyclomatic 16) crates/koharu-pipeline/src/stages/inpainting.rs:430 — koharu_pipeline::stages::inpainting::prepare 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.
D2 · Cognitive Complexity · koharu_app · ×2
  • koharu_app::commands::project::rasterize_stroke (cognitive 30) crates/koharu-app/src/commands/project.rs:1266 — koharu_app::commands::project::rasterize_stroke has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 4 (12 pts), match/switch 1 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_app::commands::canvas::encode_mask (cognitive 21) crates/koharu-app/src/commands/canvas.rs:378 — koharu_app::commands::canvas::encode_mask has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · koharu_psd · ×2
  • koharu_psd::document::build (cognitive 26) crates/koharu-psd/src/document.rs:88 — koharu_psd::document::build has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 7 (9 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • koharu_psd::engine_data::write_value (cognitive 20) crates/koharu-psd/src/engine_data.rs:616 — koharu_psd::engine_data::write_value has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 6 (9 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Traversal · ×2
  • Traversal::visit_children (cognitive 26) crates/koharu-renderer/src/renderer.rs:584 — Traversal::visit_children has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (4 pts), match/switch 1 (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.
  • Traversal::text_draft (cognitive 16) crates/koharu-renderer/src/renderer.rs:714 — Traversal::text_draft has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CanvasState · ×2
  • CanvasState::composition (cognitive 19) crates/koharu-canvas/src/web.rs:791 — CanvasState::composition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, 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.
  • CanvasState::activate_manifest (cognitive 18) crates/koharu-canvas/src/web.rs:660 — CanvasState::activate_manifest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: diffusion.rs ↔ llama.rs crates/koharu-runtime/src/runtime/packages/diffusion.rs:1 — `crates/koharu-runtime/src/runtime/packages/diffusion.rs` and `crates/koharu-runtime/src/runtime/packages/llama.rs` change together 80% of the time (12 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `2762080e` chore(runtime): update llama and diffusion releases; `67d507b4` feat(runtime): update native runtimes and CUDA 13.3; `087b40aa` refactor(runtime): simplify accelerator discovery — run `git show` on any of them.
  • Change coupling: mod.rs ↔ mod.rs crates/koharu-ml/src/comic_text_detector/mod.rs:1 — `crates/koharu-ml/src/comic_text_detector/mod.rs` and `crates/koharu-ml/src/lama/mod.rs` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `680311ce` Use explicit device dtype conversions when loading models; `6f1494af` perf: improve inpainting (at that commit the files were still `koharu-ml/src/comic_text_detector/mod.rs` and `koharu-ml/src/lama/mod.rs`); `3e4b068e` refactor(ml): shared TextRegion/TextDirection types for pipeline engines (at that commit the files were still `koharu-ml/src/comic_text_detector/mod.rs` and `koharu-ml/src/lama/mod.rs`) — run `git show` on any of them.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/koharu-llama/src/context/kv_cache.rs:57 — crates/koharu-llama/src/context/kv_cache.rs:57-67 | crates/koharu-llama/src/context/kv_cache.rs:88-100 | crates/koharu-llama/src/context/kv_cache.rs:143-153 | crates/koharu-llama/src/context/kv_cache.rs:179-189 | crates/koharu-llama/src/context/kv_cache.rs:213-225 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/koharu-translator/src/remote/deepseek.rs:53 — crates/koharu-translator/src/remote/deepseek.rs:53-106 | crates/koharu-translator/src/remote/lm_studio.rs:39-99 | crates/koharu-translator/src/remote/openai.rs:79-139 | crates/koharu-translator/src/remote/openai_compatible.rs:39-103 | crates/koharu-translator/src/remote/openrouter.rs:30-98 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×2
  • Edited copy of a member (48 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:754 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:754-804 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:652-699 — 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/koharu-ml/src/pp_ocr_v6/det/processor.rs:66 — crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:66-113 | crates/koharu-ml/src/pp_ocr_v6/rec/processor.rs:76-134 — 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 (27 corresponding lines) · ×2
  • Edited copy of a member (27 corresponding lines) crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:552 — crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:552-579 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:620-646 — 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/koharu-scene/src/edit.rs:348 — crates/koharu-scene/src/edit.rs:348-378 | crates/koharu-scene/src/edit.rs:380-406 — 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 (18 corresponding lines) · ×2
  • Edited copy of a member (18 corresponding lines) crates/koharu-torch/src/vision/inception.rs:41 — crates/koharu-torch/src/vision/inception.rs:41-58 | crates/koharu-torch/src/vision/inception.rs:104-123 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs:1320 — crates/koharu-ml/src/comic_text_detector/processor.rs:1320-1337 | crates/koharu-ml/src/comic_text_detector/processor.rs:1339-1357 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×2
  • Edited copy of a member (21 corresponding lines) crates/koharu-app/src/commands/lifecycle.rs:183 — crates/koharu-app/src/commands/lifecycle.rs:183-209 | crates/koharu-app/src/commands/lifecycle.rs:313-333 — 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/koharu-ml/src/baberu_ocr/model.rs:572 — crates/koharu-ml/src/baberu_ocr/model.rs:572-595 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:641-661 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 23+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/mod.rs:39 — crates/koharu-ml/src/comic_layout_yolo26s/mod.rs:39-61 | crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:35-58 | crates/koharu-ml/src/speech_bubble_yolov8m/mod.rs:35-58 — 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.
  • Edited copies of one member (3 members, 23+ corresponding lines) crates/koharu-canvas/src/web.rs:227 — crates/koharu-canvas/src/web.rs:227-251 | crates/koharu-rasterizer/src/compositor.rs:170-192 | crates/koharu-rasterizer/src/compositor.rs:875-901 — 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, 14+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 14+ corresponding lines) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:149 — crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:149-170 | crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:66-81 | crates/koharu-ml/src/bin/speech_bubble_yolov8m.rs:67-80 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) crates/koharu-ml/src/aot_inpainting/processor.rs:120 — crates/koharu-ml/src/aot_inpainting/processor.rs:120-133 | crates/koharu-ml/src/aot_inpainting/processor.rs:135-148 | crates/koharu-ml/src/rorem_mixed/processor.rs:163-176 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 17+ corresponding lines) crates/koharu-torch/src/nn/batch_norm.rs:45 — crates/koharu-torch/src/nn/batch_norm.rs:45-62 | crates/koharu-torch/src/nn/group_norm.rs:43-59 | crates/koharu-torch/src/nn/layer_norm.rs:40-57 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:724 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:724-741 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1950-1974 | crates/koharu-ml/src/pp_ocr_v6/det/model.rs:107-123 — 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 (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) crates/koharu-ml/src/bin/baberu_ocr.rs:18 — crates/koharu-ml/src/bin/baberu_ocr.rs:18-27 | crates/koharu-ml/src/bin/hayai_ocr.rs:18-27 | crates/koharu-ml/src/bin/manga_ocr.rs:18-27 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:299 — crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:299-308 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:310-319 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/processor.rs:321-330 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/koharu-torch/src/tensor/index.rs:232 — crates/koharu-torch/src/tensor/index.rs:232-239 | crates/koharu-torch/src/tensor/index.rs:255-263 | crates/koharu-torch/src/tensor/index.rs:280-289 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:151 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:151-158 | crates/koharu-ml/src/comic_text_detector/model.rs:263-270 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:151-158 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 7+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:391 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:391-403 | crates/koharu-ml/src/comic_layout_yolo26s/model.rs:507-513 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:394-406 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:542-554 — 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.
  • Edited copies of one member (4 members, 7+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:340 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:340-346 | crates/koharu-ml/src/comic_text_detector/model.rs:318-324 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:232-238 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:264-270 — 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1150 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1150-1176 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1320-1346 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (27 lines × 2) crates/koharu-runtime/src/runtime/packages/diffusion.rs:126 — crates/koharu-runtime/src/runtime/packages/diffusion.rs:126-152 | crates/koharu-runtime/src/runtime/packages/llama.rs:126-152 — before extracting anything, compare `crates/koharu-runtime/src/runtime/packages/diffusion.rs` and `crates/koharu-runtime/src/runtime/packages/llama.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:924 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:924-949 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1050-1075 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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 (26 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:400 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:400-425 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:344-369 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×2
  • Duplicated block (25 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1673 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1673-1697 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:2160-2184 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (25 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:812 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:812-836 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:707-731 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1115 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1115-1137 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1287-1309 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (23 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:189 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:189-211 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:269-291 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×2
  • Duplicated block (21 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:72 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:72-92 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:82-102 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) crates/koharu-ml/src/comic_text_detector/model.rs:176 — crates/koharu-ml/src/comic_text_detector/model.rs:176-196 | crates/koharu-ml/src/comic_text_detector/model.rs:226-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-ml/src/comic_text_detector/model.rs:176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:326 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:326-338 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:315-326 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (12–13 lines × 2) crates/koharu-ml/src/pp_doclayout_v3/processor.rs:431 — crates/koharu-ml/src/pp_doclayout_v3/processor.rs:431-443 | crates/koharu-pipeline/src/stages/detection.rs:1330-1341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×2
  • Duplicated block (13 lines × 2) crates/koharu-runtime/src/hardware/hip/linux.rs:70 — crates/koharu-runtime/src/hardware/hip/linux.rs:70-82 | crates/koharu-runtime/src/hardware/hip/windows.rs:81-93 — 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/koharu-runtime/src/hardware/hip/linux.rs:70` 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/koharu-runtime/src/hardware/hip/linux.rs:69` calls `to_string` and `crates/koharu-runtime/src/hardware/hip/windows.rs:80` 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) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:174 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:174-186 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:254-266 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×2
  • Duplicated block (9 lines × 3) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:420 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:420-428 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:364-372 | crates/koharu-renderer/src/bubble.rs:256-264 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:420` 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 × 3) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1389 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1389-1397 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs:1165-1173 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1607-1615 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:155 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:155-162 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:147-153 — `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 10 separate duplicated blocks between them, totalling at least 131 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–8 lines × 2) crates/koharu-torch/src/vision/resnet.rs:32 — crates/koharu-torch/src/vision/resnet.rs:32-38 | crates/koharu-torch/src/vision/resnet.rs:116-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-torch/src/vision/resnet.rs:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/koharu-torch/src/vision/resnet.rs:123` calls `apply_t`, `relu` and `crates/koharu-torch/src/vision/resnet.rs:38` 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs:599 — crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs:599-605 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs:609-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/model.rs:599` 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–7 lines × 2) crates/koharu-torch/src/tensor/display.rs:220 — crates/koharu-torch/src/tensor/display.rs:220-225 | crates/koharu-torch/src/tensor/display.rs:228-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-torch/src/tensor/display.rs:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
R10 · Code Duplication · Duplicated block (31 lines × 2 locations) · ×2
  • Duplicated block (31 lines × 2 locations) packages/ui/src/components/empty.tsx:34 — packages/ui/src/components/empty.tsx:34 · packages/ui/src/components/item.tsx:91 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (31 lines × 2 locations) packages/ui/src/components/field.tsx:10 — packages/ui/src/components/field.tsx:10 · packages/ui/src/components/message.tsx:5 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (30 lines × 2 locations) · ×2
  • Duplicated block (30 lines × 2 locations) packages/ui/src/components/context-menu.tsx:155 — packages/ui/src/components/context-menu.tsx:155 · packages/ui/src/components/menubar.tsx:109 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (30 lines × 2 locations) packages/ui/src/components/popover.tsx:8 — packages/ui/src/components/popover.tsx:8 · packages/ui/src/components/tooltip.tsx:20 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block with local edits (15 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (15 matched lines × 2 locations) packages/koharu/components/controls/ModelPicker.tsx:55 — packages/koharu/components/controls/ModelPicker.tsx:55 · packages/koharu/components/controls/OutputPicker.tsx:103 — the two spans are one implementation copied and then locally edited — 61 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (15 matched lines × 2 locations) packages/koharu/components/controls/ModelPicker.tsx:53 — packages/koharu/components/controls/ModelPicker.tsx:53 · packages/koharu/components/editor/InferenceControl.tsx:386 — the two spans are one implementation copied and then locally edited — 54 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (15 lines × 3 locations) · ×2
  • Duplicated block (15 lines × 3 locations) packages/ui/src/components/attachment.tsx:59 — packages/ui/src/components/attachment.tsx:59 · packages/ui/src/components/empty.tsx:37 · packages/ui/src/components/item.tsx:94 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 3 locations) packages/ui/src/components/breadcrumb.tsx:36 — packages/ui/src/components/breadcrumb.tsx:36 · packages/ui/src/components/bubble.tsx:59 · packages/ui/src/components/button-group.tsx:35 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×2
  • Duplicated block (14 lines × 2 locations) packages/koharu/components/editor/ActivityCenter.tsx:117 — packages/koharu/components/editor/ActivityCenter.tsx:117 · packages/koharu/components/editor/ActivityCenter.tsx:170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2 locations) packages/ui/src/components/button.tsx:43 — packages/ui/src/components/button.tsx:43 · packages/ui/src/components/toggle.tsx:30 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (9 lines × 2 locations) · ×2
  • Duplicated block (9 lines × 2 locations) packages/koharu/components/editor/CanvasWorkspace.tsx:901 — packages/koharu/components/editor/CanvasWorkspace.tsx:901 · packages/koharu/components/editor/Inspector.tsx:1032 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (9 lines × 2 locations) packages/koharu/components/preferences/GenerationPreferences.tsx:46 — packages/koharu/components/preferences/GenerationPreferences.tsx:46 · packages/koharu/components/preferences/PipelinePreferences.tsx:122 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
AC2 · Forms & labels · <Select> field component without a label · ×1
  • <Select> field component without a label packages/koharu/components/preferences/SettingsPage.tsx:277 — This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC3 · Page structure · Page without a main landmark · ×1
  • Page without a main landmark packages/koharu/app/layout.tsx:24 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC6 · Visual & motion safety · Focus outline removed inline · ×1
  • Focus outline removed inline packages/koharu/components/editor/CanvasWorkspace.tsx:591 — <div> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
D1 · Cyclomatic Complexity · CanvasWorkspace.CanvasWorkspace (cyclomatic 148) · ×1
  • CanvasWorkspace.CanvasWorkspace (cyclomatic 148) packages/koharu/components/editor/CanvasWorkspace.tsx:91 — CanvasWorkspace.CanvasWorkspace has cyclomatic complexity 148 (threshold 15). Of this number, 16 points are the body's own statements and 132 belong to 28 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PageRail.PageRail (cyclomatic 44) · ×1
  • PageRail.PageRail (cyclomatic 44) packages/koharu/components/editor/PageRail.tsx:69 — PageRail.PageRail has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 5 of the 44 points are its own statements and the rest belongs to 15 function items inside it that branch (select, prefetchOnIntent, select::synchronize, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · Inspector.LayersInspector (cyclomatic 37) · ×1
  • Inspector.LayersInspector (cyclomatic 37) packages/koharu/components/editor/Inspector.tsx:493 — Inspector.LayersInspector has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 4 of the 37 points are its own statements and the rest belongs to 11 function items inside it that branch (selectLayer, a function literal at line 598, move, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AgentPanel.AgentPanel (cyclomatic 36) · ×1
  • AgentPanel.AgentPanel (cyclomatic 36) packages/koharu/components/editor/AgentPanel.tsx:38 — AgentPanel.AgentPanel has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 293, send, a function literal at line 120, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · koharu_scene · ×1
  • koharu_scene::schema::validate_entity (cyclomatic 34) crates/koharu-scene/src/schema.rs:75 — koharu_scene::schema::validate_entity has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SettingsPage.SettingsPage (cyclomatic 34) · ×1
  • SettingsPage.SettingsPage (cyclomatic 34) packages/koharu/components/preferences/SettingsPage.tsx:58 — SettingsPage.SettingsPage has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 15 of the 34 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 83, 144, 163, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Header · ×1
  • Header::parse (cyclomatic 32) crates/koharu-torch/src/tensor/npy.rs:80 — Header::parse 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.
D1 · Cyclomatic Complexity · Operation · ×1
  • Operation::apply (cyclomatic 28) crates/koharu-scene/src/patch.rs:76 — Operation::apply 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.
D1 · Cyclomatic Complexity · Updater.Updater (cyclomatic 27) · ×1
  • Updater.Updater (cyclomatic 27) packages/koharu/components/app/Updater.tsx:31 — Updater.Updater has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModelPicker.ModelPicker (cyclomatic 27) · ×1
  • ModelPicker.ModelPicker (cyclomatic 27) packages/koharu/components/controls/ModelPicker.tsx:18 — ModelPicker.ModelPicker has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 112, 47, 65, …). 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.
D1 · Cyclomatic Complexity · InferenceControl.RuntimeSelector (cyclomatic 26) · ×1
  • InferenceControl.RuntimeSelector (cyclomatic 26) packages/koharu/components/editor/InferenceControl.tsx:86 — InferenceControl.RuntimeSelector has cyclomatic complexity 26 (threshold 15). Of this number, 13 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Inspector.TypeInspector (cyclomatic 25) · ×1
  • Inspector.TypeInspector (cyclomatic 25) packages/koharu/components/editor/Inspector.tsx:131 — Inspector.TypeInspector has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (apply, a function literal at line 385, a function literal at line 414, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · koharu_agent · ×1
  • koharu_agent::codex::stream::read (cyclomatic 23) crates/koharu-agent/src/codex/stream.rs:23 — koharu_agent::codex::stream::read 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.
D1 · Cyclomatic Complexity · SelectionControls.SelectionControls (cyclomatic 23) · ×1
  • SelectionControls.SelectionControls (cyclomatic 23) packages/koharu/components/editor/SelectionControls.tsx:46 — SelectionControls.SelectionControls has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 144, update, startRotate, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · useCanvas.useCanvas (cyclomatic 23) · ×1
  • useCanvas.useCanvas (cyclomatic 23) packages/koharu/components/editor/useCanvas.ts:25 — useCanvas.useCanvas has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 95, 58, 130, …). 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.
D1 · Cyclomatic Complexity · Tensor · ×1
  • Tensor::f_indexer (cyclomatic 22) crates/koharu-torch/src/tensor/index.rs:293 — Tensor::f_indexer has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · chart.ChartTooltipContent (cyclomatic 22) · ×1
  • chart.ChartTooltipContent (cyclomatic 22) REDACTED:119 — chart.ChartTooltipContent has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 202, 149). 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.
D1 · Cyclomatic Complexity · FontPicker.FontPicker (cyclomatic 21) · ×1
  • FontPicker.FontPicker (cyclomatic 21) packages/koharu/components/controls/FontPicker.tsx:50 — FontPicker.FontPicker has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 87, 75, 116). 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.
D1 · Cyclomatic Complexity · CanvasOverlay.CanvasOverlay (cyclomatic 21) · ×1
  • CanvasOverlay.CanvasOverlay (cyclomatic 21) packages/koharu/components/editor/CanvasOverlay.tsx:33 — CanvasOverlay.CanvasOverlay has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · geometry.layerFrame (cyclomatic 21) · ×1
  • geometry.layerFrame (cyclomatic 21) packages/koharu/lib/geometry.ts:65 — geometry.layerFrame 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.
D1 · Cyclomatic Complexity · koharu_psd · ×1
  • koharu_psd::document::build (cyclomatic 20) crates/koharu-psd/src/document.rs:88 — koharu_psd::document::build has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · GpuCompositor · ×1
  • GpuCompositor::render (cyclomatic 19) crates/koharu-rasterizer/src/compositor.rs:453 — GpuCompositor::render has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TextRenderer · ×1
  • TextRenderer::render_descriptor (cyclomatic 18) crates/koharu-renderer/src/text_renderer.rs:148 — TextRenderer::render_descriptor 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.
D1 · Cyclomatic Complexity · Edit · ×1
  • Edit::remove_entity (cyclomatic 18) crates/koharu-scene/src/edit.rs:202 — Edit::remove_entity has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · koharu_runtime · ×1
  • koharu_runtime::hardware::hip::linux::probe (cyclomatic 17) crates/koharu-runtime/src/hardware/hip/linux.rs:13 — koharu_runtime::hardware::hip::linux::probe 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.
D1 · Cyclomatic Complexity · TensorFormatter · ×1
  • TensorFormatter::fmt_tensor (cyclomatic 17) crates/koharu-torch/src/tensor/display.rs:171 — TensorFormatter::fmt_tensor 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.
D1 · Cyclomatic Complexity · Model · ×1
  • Model::run (cyclomatic 16) crates/koharu-pipeline/src/stages/inpainting.rs:177 — Model::run 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.
D17 · Explicit Debt · HackComment · ×1
  • HackComment crates/koharu-torch/src/tensor/npy.rs:78 — // Hacky parser for the npy header, a typical example would be: — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · PageRail.PageRail (cognitive 46) · ×1
  • PageRail.PageRail (cognitive 46) packages/koharu/components/editor/PageRail.tsx:69 — PageRail.PageRail has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 14, ternaries 3 (6 pts) (nesting depth added 7). Most of this is not in the body itself: 5 of the 46 points are its own statements and the rest belongs to 15 function items inside it that branch (select, prefetchOnIntent, select::synchronize, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · TensorFormatter · ×1
  • TensorFormatter::fmt_tensor (cognitive 37) crates/koharu-torch/src/tensor/display.rs:171 — TensorFormatter::fmt_tensor has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 6 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Inspector.LayersInspector (cognitive 37) · ×1
  • Inspector.LayersInspector (cognitive 37) packages/koharu/components/editor/Inspector.tsx:493 — Inspector.LayersInspector has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 14, ternaries 11 (14 pts), if/else 8 (9 pts) (nesting depth added 4). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 11 function items inside it that branch (selectLayer, move, a function literal at line 598, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · koharu_scene · ×1
  • koharu_scene::schema::validate_entity (cognitive 36) crates/koharu-scene/src/schema.rs:75 — koharu_scene::schema::validate_entity has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 18, if/else 16 (18 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Operation · ×1
  • Operation::apply (cognitive 31) crates/koharu-scene/src/patch.rs:76 — Operation::apply has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, loops 1 (2 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · koharu_agent · ×1
  • koharu_agent::codex::stream::read (cognitive 30) crates/koharu-agent/src/codex/stream.rs:23 — koharu_agent::codex::stream::read has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentPanel.AgentPanel (cognitive 29) · ×1
  • AgentPanel.AgentPanel (cognitive 29) packages/koharu/components/editor/AgentPanel.tsx:38 — AgentPanel.AgentPanel has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 11 (16 pts), boolean chains 7, if/else 5, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 8 function items inside it that branch (send, a function literal at line 120, a function literal at line 170, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · GpuCompositor · ×1
  • GpuCompositor::render (cognitive 28) crates/koharu-rasterizer/src/compositor.rs:453 — GpuCompositor::render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 3 (5 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.
D2 · Cognitive Complexity · Header · ×1
  • Header::parse (cognitive 28) crates/koharu-torch/src/tensor/npy.rs:80 — Header::parse has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 5 (9 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageSlicer · ×1
  • ImageSlicer::merge_overlapping_boxes (cognitive 26) crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:310 — ImageSlicer::merge_overlapping_boxes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · koharu_runtime · ×1
  • koharu_runtime::hardware::hip::linux::probe (cognitive 25) crates/koharu-runtime/src/hardware/hip/linux.rs:13 — koharu_runtime::hardware::hip::linux::probe has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (5 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SettingsPage.SettingsPage (cognitive 25) · ×1
  • SettingsPage.SettingsPage (cognitive 25) packages/koharu/components/preferences/SettingsPage.tsx:58 — SettingsPage.SettingsPage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 10, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 83, 144, 129, …). 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.
D2 · Cognitive Complexity · ModelPicker.ModelPicker (cognitive 24) · ×1
  • ModelPicker.ModelPicker (cognitive 24) packages/koharu/components/controls/ModelPicker.tsx:18 — ModelPicker.ModelPicker has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, ternaries 6, if/else 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 112, 137, 47, …). 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.
D2 · Cognitive Complexity · Updater.Updater (cognitive 23) · ×1
  • Updater.Updater (cognitive 23) packages/koharu/components/app/Updater.tsx:31 — Updater.Updater has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (9 pts), boolean chains 8, if/else 6 (nesting depth added 2). Of this number, 15 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Inspector.TypeInspector (cognitive 23) · ×1
  • Inspector.TypeInspector (cognitive 23) packages/koharu/components/editor/Inspector.tsx:131 — Inspector.TypeInspector has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13 (14 pts), if/else 5, boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 385, apply, a function literal at line 414, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · useCanvas.useCanvas (cognitive 23) · ×1
  • useCanvas.useCanvas (cognitive 23) packages/koharu/components/editor/useCanvas.ts:25 — useCanvas.useCanvas has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 3). None of this is in the body itself: all 23 points belong to 10 function literals inside it that branch (lines 95, 130, 58, …). 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.
D2 · Cognitive Complexity · geometry.layerFrame (cognitive 23) · ×1
  • geometry.layerFrame (cognitive 23) packages/koharu/lib/geometry.ts:65 — geometry.layerFrame has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Processor · ×1
  • Processor::process (cognitive 22) crates/koharu-pipeline/src/stages/translation.rs:37 — Processor::process has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextRenderer · ×1
  • TextRenderer::render_descriptor (cognitive 22) crates/koharu-renderer/src/text_renderer.rs:148 — TextRenderer::render_descriptor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SelectionControls.SelectionControls (cognitive 22) · ×1
  • SelectionControls.SelectionControls (cognitive 22) packages/koharu/components/editor/SelectionControls.tsx:46 — SelectionControls.SelectionControls has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 4. None of this is in the body itself: all 22 points belong to 7 function items inside it that branch (a function literal at line 144, update, startRotate, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · chart.ChartTooltipContent (cognitive 22) · ×1
  • chart.ChartTooltipContent (cognitive 22) REDACTED:119 — chart.ChartTooltipContent has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 6 (9 pts), if/else 4 (nesting depth added 3). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 202, 149). 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.
D2 · Cognitive Complexity · Edit · ×1
  • Edit::remove_entity (cognitive 21) crates/koharu-scene/src/edit.rs:202 — Edit::remove_entity has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 7, boolean chains 4, 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.
D2 · Cognitive Complexity · Project · ×1
  • Project::apply_raster_stroke (cognitive 20) crates/koharu-app/src/commands/project.rs:741 — Project::apply_raster_stroke has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Tensor · ×1
  • Tensor::f_indexer (cognitive 20) crates/koharu-torch/src/tensor/index.rs:293 — Tensor::f_indexer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (8 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.
D2 · Cognitive Complexity · InferenceControl.RuntimeSelector (cognitive 20) · ×1
  • InferenceControl.RuntimeSelector (cognitive 20) packages/koharu/components/editor/InferenceControl.tsx:86 — InferenceControl.RuntimeSelector has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (chooseModel, saveOutput, toggleStage, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Flux2ImageProcessor · ×1
  • Flux2ImageProcessor::get_crop_region (cognitive 19) crates/koharu-ml/src/flux2_klein/processor.rs:91 — Flux2ImageProcessor::get_crop_region has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 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.
D2 · Cognitive Complexity · koharu_rasterizer · ×1
  • koharu_rasterizer::frame::compile_frame (cognitive 19) crates/koharu-rasterizer/src/frame.rs:345 — koharu_rasterizer::frame::compile_frame has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 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.
D2 · Cognitive Complexity · FontSystem · ×1
  • FontSystem::resolve_with_fallback_families (cognitive 19) crates/koharu-renderer/src/fonts.rs:399 — FontSystem::resolve_with_fallback_families has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BlobStore · ×1
  • BlobStore::collect (cognitive 19) crates/koharu-storage/src/blobs.rs:91 — BlobStore::collect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · koharu_torch · ×1
  • koharu_torch::nn::init::f_init (cognitive 19) crates/koharu-torch/src/nn/init.rs:108 — koharu_torch::nn::init::f_init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (3 pts), boolean chains 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.
D2 · Cognitive Complexity · CanvasOverlay.CanvasOverlay (cognitive 19) · ×1
  • CanvasOverlay.CanvasOverlay (cognitive 19) packages/koharu/components/editor/CanvasOverlay.tsx:33 — CanvasOverlay.CanvasOverlay has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, ternaries 7, if/else 1. Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 89, 58, 76). 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.
D2 · Cognitive Complexity · CanvasWorkspace.CanvasWorkspace · ×1
  • CanvasWorkspace.CanvasWorkspace::finishGesture (cognitive 19) packages/koharu/components/editor/CanvasWorkspace.tsx:503 — CanvasWorkspace.CanvasWorkspace::finishGesture has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 5, boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · canvas.prefetchCanvasPages (cognitive 18) · ×1
  • canvas.prefetchCanvasPages (cognitive 18) packages/bridge/src/canvas.ts:246 — canvas.prefetchCanvasPages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). Of this number, 17 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.
D2 · Cognitive Complexity · GridGenerator · ×1
  • GridGenerator::new (cognitive 17) crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:237 — GridGenerator::new has cognitive complexity 17 (threshold 15). Drivers by points: loops 8 (13 pts), if/else 2 (4 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Fonts · ×1
  • Fonts::resolve (cognitive 17) crates/koharu-renderer/src/fonts.rs:682 — Fonts::resolve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D2 · Cognitive Complexity · VarStore · ×1
  • VarStore::merge (cognitive 17) crates/koharu-torch/src/nn/var_store.rs:68 — VarStore::merge has cognitive complexity 17 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · providers.Providers (cognitive 17) · ×1
  • providers.Providers (cognitive 17) packages/koharu/app/providers.tsx:33 — providers.Providers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 7). None of this is in the body itself: all 17 points belong to 6 function literals inside it that branch (lines 62, 52, 36, …). 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.
D2 · Cognitive Complexity · FontPicker.fontNameScript (cognitive 17) · ×1
  • FontPicker.fontNameScript (cognitive 17) packages/koharu/components/controls/FontPicker.tsx:525 — FontPicker.fontNameScript has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 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.
D2 · Cognitive Complexity · Rasterizer · ×1
  • Rasterizer::finish_readback (cognitive 16) crates/koharu-rasterizer/src/native.rs:372 — Rasterizer::finish_readback has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (9 pts), match/switch 1 (4 pts), if/else 2 (3 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · LineBreaker · ×1
  • LineBreaker::hyphenated_segments (cognitive 16) crates/koharu-renderer/src/segment.rs:184 — LineBreaker::hyphenated_segments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (46 shared lines) · ×1
  • Near-duplicate member pair (46 shared lines) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:110 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:110-214 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:103-205 — These two members are variants of one another: 46 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 · Near-duplicate member pair (23 shared lines) · ×1
  • Near-duplicate member pair (23 shared lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:99 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:99-188 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:110-214 — These two members are variants of one another: 23 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (55 corresponding lines) · ×1
  • Edited copy of a member (55 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:434 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:434-488 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:378-436 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1251 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1251-1316 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1406-1482 — 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 (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:310 — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:310-370 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:314-377 — 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 (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) crates/koharu-app/src/commands/import/rar.rs:39 — crates/koharu-app/src/commands/import/rar.rs:39-89 | crates/koharu-app/src/commands/import/zip.rs:7-76 — 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 copies of one member (3 members, 43+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 43+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:355 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:355-397 | crates/koharu-ml/src/comic_text_detector/processor.rs:450-494 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:299-341 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 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 (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:49 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:49-92 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:59-102 — 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 (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) crates/koharu-rasterizer/src/native.rs:260 — crates/koharu-rasterizer/src/native.rs:260-311 | crates/koharu-rasterizer/src/native.rs:319-370 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs:496 — crates/koharu-ml/src/comic_text_detector/processor.rs:496-529 | crates/koharu-renderer/src/bubble.rs:232-264 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) crates/koharu-ml/src/bin/comic_text_detector.rs:31 — crates/koharu-ml/src/bin/comic_text_detector.rs:31-57 | crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:34-64 | crates/koharu-ml/src/bin/speech_bubble_yolov8m.rs:34-65 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 35+ corresponding lines) crates/koharu-llama/src/context/session.rs:199 — crates/koharu-llama/src/context/session.rs:199-233 | crates/koharu-llama/src/context/session.rs:297-331 | crates/koharu-llama/src/context/session.rs:406-444 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 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, 30+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 30+ corresponding lines) crates/koharu-ml/src/paddle_ocr_vl/mod.rs:39 — crates/koharu-ml/src/paddle_ocr_vl/mod.rs:39-72 | crates/koharu-ml/src/pp_doclayout_v3/mod.rs:34-71 | crates/koharu-ml/src/pp_ocr_v6/det/mod.rs:32-61 | crates/koharu-ml/src/pp_ocr_v6/rec/mod.rs:32-68 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 30 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, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) crates/koharu-app/src/commands/canvas.rs:147 — crates/koharu-app/src/commands/canvas.rs:147-164 | crates/koharu-app/src/commands/canvas.rs:173-190 | crates/koharu-app/src/commands/canvas.rs:253-286 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×1
  • Edited copy of a member (38 corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:176 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:176-223 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:528-565 — 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 copies of one member (4 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 22+ corresponding lines) crates/koharu-translator/src/remote/deepseek.rs:24 — crates/koharu-translator/src/remote/deepseek.rs:24-45 | crates/koharu-translator/src/remote/grok.rs:51-75 | crates/koharu-translator/src/remote/minimax.rs:20-41 | crates/koharu-translator/src/remote/openai.rs:22-44 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1114 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:1114-1147 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:1286-1317 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 19+ corresponding lines) crates/koharu-runtime/src/runtime/packages/cuda.rs:139 — crates/koharu-runtime/src/runtime/packages/cuda.rs:139-157 | crates/koharu-runtime/src/runtime/packages/diffusion.rs:98-121 | crates/koharu-runtime/src/runtime/packages/llama.rs:98-121 | crates/koharu-runtime/src/runtime/packages/torch.rs:88-112 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (8 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (8 members, 12+ corresponding lines) crates/koharu-app/src/commands/editing.rs:42 — crates/koharu-app/src/commands/editing.rs:42-53 | crates/koharu-app/src/commands/editing.rs:84-95 | crates/koharu-app/src/commands/editing.rs:105-116 | crates/koharu-app/src/commands/editing.rs:126-137 | crates/koharu-app/src/commands/editing.rs:146-157 | crates/koharu-app/src/commands/editing.rs:166-177 | crates/koharu-app/src/commands/editing.rs:188-199 | crates/koharu-app/src/commands/editing.rs:208-219 — These 8 members are one piece of code written 8 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 8 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) crates/koharu-llama/src/context/session.rs:161 — crates/koharu-llama/src/context/session.rs:161-181 | crates/koharu-llama/src/context/session.rs:253-273 | crates/koharu-llama/src/context/session.rs:357-380 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) crates/koharu-app/src/commands/editing.rs:62 — crates/koharu-app/src/commands/editing.rs:62-74 | crates/koharu-app/src/commands/editing.rs:253-264 | crates/koharu-app/src/commands/editing.rs:272-283 — These 3 members are one piece of code written 3 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 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/koharu-torch/src/wrappers/jit.rs:507 — crates/koharu-torch/src/wrappers/jit.rs:507-518 | crates/koharu-torch/src/wrappers/jit.rs:542-558 | crates/koharu-torch/src/wrappers/jit.rs:565-581 | crates/koharu-torch/src/wrappers/jit.rs:851-867 — 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, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) crates/koharu-ml/src/aot_inpainting/mod.rs:25 — crates/koharu-ml/src/aot_inpainting/mod.rs:25-39 | crates/koharu-ml/src/comic_onomatopoeia/detector/mod.rs:28-45 | crates/koharu-ml/src/manga_text_mask/mod.rs:25-39 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) crates/koharu-ml/src/comic_text_detector/model.rs:175 — crates/koharu-ml/src/comic_text_detector/model.rs:175-199 | crates/koharu-ml/src/comic_text_detector/model.rs:281-306 — 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) crates/koharu-torch/src/wrappers/tensor.rs:636 — crates/koharu-torch/src/wrappers/tensor.rs:636-645 | crates/koharu-torch/src/wrappers/tensor.rs:654-664 | crates/koharu-torch/src/wrappers/tensor.rs:705-714 | crates/koharu-torch/src/wrappers/tensor.rs:724-734 — 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, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) crates/koharu-torch/src/vision/rust_image.rs:67 — crates/koharu-torch/src/vision/rust_image.rs:67-72 | crates/koharu-torch/src/vision/rust_image.rs:95-100 | crates/koharu-torch/src/vision/rust_image.rs:107-112 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 11+ corresponding lines) crates/koharu-ml/src/baberu_ocr/processor.rs:105 — crates/koharu-ml/src/baberu_ocr/processor.rs:105-117 | crates/koharu-ml/src/hayai_ocr/processor.rs:166-178 | crates/koharu-ml/src/lama/processor.rs:155-165 | crates/koharu-ml/src/lama/processor.rs:167-177 | crates/koharu-ml/src/manga_ocr/processor.rs:84-96 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 7+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/mod.rs:71 — crates/koharu-ml/src/comic_layout_yolo26s/mod.rs:71-78 | crates/koharu-ml/src/comic_onomatopoeia/detector/mod.rs:47-53 | crates/koharu-ml/src/font_detector/mod.rs:56-66 | crates/koharu-ml/src/koharu_layout_rfdetr_seg_2xl/mod.rs:72-79 | crates/koharu-ml/src/pp_doclayout_v3/mod.rs:77-83 | crates/koharu-ml/src/speech_bubble_yolo11n/mod.rs:73-80 | crates/koharu-ml/src/speech_bubble_yolov8m/mod.rs:73-80 — These 7 members are one piece of code written 7 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 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×1
  • Edited copy of a member (3 corresponding lines) crates/koharu-ml/src/comic_text_detector/processor.rs:1359 — crates/koharu-ml/src/comic_text_detector/processor.rs:1359-1361 | crates/koharu-pipeline/src/stages/detection.rs:1829-1831 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 4+ corresponding lines) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:124 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:124-127 | crates/koharu-ml/src/comic_text_detector/model.rs:201-204 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:124-127 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:196-199 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 4+ corresponding lines) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:44 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:44-47 | crates/koharu-ml/src/manga_text_mask/model.rs:50-54 | crates/koharu-ml/src/pp_ocr_v6/det/model.rs:50-53 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (40–42 lines × 2) · ×1
  • Duplicated block (40–42 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:564 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:564-603 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:516-557 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) crates/koharu-translator/src/remote/lm_studio.rs:50 — crates/koharu-translator/src/remote/lm_studio.rs:50-82 | crates/koharu-translator/src/remote/openai_compatible.rs:50-82 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai_compatible.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 140 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 `crates/koharu-translator/src/remote/lm_studio.rs:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:435 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:435-465 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:380-410 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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.
D4 · Code Duplication · Duplicated block (28–29 lines × 2) · ×1
  • Duplicated block (28–29 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:205 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:205-232 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:231-259 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (27 lines × 3) · ×1
  • Duplicated block (27 lines × 3) crates/koharu-translator/src/remote/lm_studio.rs:43 — crates/koharu-translator/src/remote/lm_studio.rs:43-69 | crates/koharu-translator/src/remote/openai_compatible.rs:43-69 | crates/koharu-translator/src/remote/openrouter.rs:35-61 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai_compatible.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 140 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 `crates/koharu-translator/src/remote/lm_studio.rs:43` 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.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) crates/koharu-llama/src/model.rs:446 — crates/koharu-llama/src/model.rs:446-473 | crates/koharu-llama/src/model.rs:548-575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-llama/src/model.rs:548` 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.
D4 · Code Duplication · Duplicated block (25 lines × 4) · ×1
  • Duplicated block (25 lines × 4) crates/koharu-translator/src/remote/lm_studio.rs:42 — crates/koharu-translator/src/remote/lm_studio.rs:42-66 | crates/koharu-translator/src/remote/openai.rs:82-106 | crates/koharu-translator/src/remote/openai_compatible.rs:42-66 | crates/koharu-translator/src/remote/openrouter.rs:34-58 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/koharu-translator/src/remote/lm_studio.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24 lines × 5) · ×1
  • Duplicated block (24 lines × 5) crates/koharu-translator/src/remote/deepseek.rs:55 — crates/koharu-translator/src/remote/deepseek.rs:55-78 | crates/koharu-translator/src/remote/lm_studio.rs:41-64 | crates/koharu-translator/src/remote/openai.rs:81-104 | crates/koharu-translator/src/remote/openai_compatible.rs:41-64 | crates/koharu-translator/src/remote/openrouter.rs:33-56 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/koharu-translator/src/remote/deepseek.rs:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/koharu-translator/src/remote/deepseek.rs:79` calls `Some` and `crates/koharu-translator/src/remote/lm_studio.rs:65` 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.
D4 · Code Duplication · Duplicated block (21–23 lines × 3) · ×1
  • Duplicated block (21–23 lines × 3) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:50 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:50-70 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:60-80 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:51-73 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:375 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:375-397 | crates/koharu-ml/src/comic_text_detector/processor.rs:472-494 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:319-341 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/comic_text_detector/processor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:375` 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.
D4 · Code Duplication · Duplicated block (60 lines × 2) · ×1
  • Duplicated block (60 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:609 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:609-668 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:560-619 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:609` 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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×1
  • Duplicated block (19 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:865 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:865-883 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:990-1008 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:356 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:356-372 | crates/koharu-ml/src/comic_text_detector/processor.rs:451-467 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:300-316 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/comic_text_detector/processor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:356` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:297 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:297-310 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:189-203 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/model.rs:297` 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, `crates/koharu-ml/src/comic_layout_yolo26s/model.rs:295` calls `Attention`, `load`, `C3k` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:189` 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.
D4 · Code Duplication · Duplicated block (55–56 lines × 2) · ×1
  • Duplicated block (55–56 lines × 2) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:501 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:501-555 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:450-505 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) crates/koharu-translator/src/remote/lm_studio.rs:68 — crates/koharu-translator/src/remote/lm_studio.rs:68-81 | crates/koharu-translator/src/remote/openai.rs:108-121 | crates/koharu-translator/src/remote/openai_compatible.rs:68-81 — before extracting anything, compare `crates/koharu-translator/src/remote/lm_studio.rs` and `crates/koharu-translator/src/remote/openai.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 `crates/koharu-translator/src/remote/lm_studio.rs:68` 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.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) crates/koharu-llama/src/model.rs:950 — crates/koharu-llama/src/model.rs:950-963 | crates/koharu-llama/src/model.rs:968-980 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:298 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:298-307 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:276-289 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/pp_doclayout_v3/model.rs:276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) crates/koharu-ml/src/aot_inpainting/processor.rs:197 — crates/koharu-ml/src/aot_inpainting/processor.rs:197-208 | crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:373-384 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:433-444 | crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:436-447 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/speech_bubble_yolov8m/processor.rs:436` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `f64` in one and `f32` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) crates/koharu-runtime/src/runtime/packages/diffusion.rs:110 — crates/koharu-runtime/src/runtime/packages/diffusion.rs:110-121 | crates/koharu-runtime/src/runtime/packages/llama.rs:110-121 | crates/koharu-runtime/src/runtime/packages/torch.rs:101-112 — before extracting anything, compare `crates/koharu-runtime/src/runtime/packages/diffusion.rs` and `crates/koharu-runtime/src/runtime/packages/llama.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-runtime/src/runtime/packages/diffusion.rs:110` 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/koharu-runtime/src/runtime/packages/diffusion.rs:107` calls `asset` and `crates/koharu-runtime/src/runtime/packages/torch.rs:98` 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.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:563 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:563-584 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:503-524 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) crates/koharu-app/src/commands/lifecycle.rs:188 — crates/koharu-app/src/commands/lifecycle.rs:188-198 | crates/koharu-app/src/commands/lifecycle.rs:314-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-app/src/commands/lifecycle.rs:188` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/model.rs:808 — crates/koharu-ml/src/comic_text_bubble_detector/model.rs:808-837 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:919-948 — `crates/koharu-ml/src/comic_text_bubble_detector/model.rs` and `crates/koharu-ml/src/pp_doclayout_v3/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 24 separate duplicated blocks between them, totalling at least 357 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) crates/koharu-ml/src/flux2_klein/mod.rs:185 — crates/koharu-ml/src/flux2_klein/mod.rs:185-194 | crates/koharu-ml/src/flux2_klein/processor.rs:76-85 | crates/koharu-ml/src/flux2_klein/processor.rs:178-187 | crates/koharu-translator/src/backend.rs:78-87 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) crates/koharu-diffusion/src/image.rs:23 — crates/koharu-diffusion/src/image.rs:23-32 | crates/koharu-diffusion/src/image.rs:35-42 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (2–10 lines × 4) · ×1
  • Duplicated block (2–10 lines × 4) crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:216 — crates/koharu-ml/src/bin/comic_layout_yolo26s.rs:216-217 | crates/koharu-ml/src/bin/koharu_layout_rfdetr_seg_2xl.rs:145-147 | crates/koharu-ml/src/bin/speech_bubble_yolo11n.rs:93-102 | crates/koharu-ml/src/bin/speech_bubble_yolov8m.rs:92-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 all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/bin/comic_layout_yolo26s.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–10 lines × 3) · ×1
  • Duplicated block (3–10 lines × 3) crates/koharu-ml/src/comic_layout_yolo26s/model.rs:394 — crates/koharu-ml/src/comic_layout_yolo26s/model.rs:394-403 | crates/koharu-ml/src/comic_layout_yolo26s/model.rs:508-510 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:397-406 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_layout_yolo26s/model.rs:394` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×1
  • Duplicated block (9–10 lines × 2) crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:140 — crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:140-148 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:164-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_text_bubble_detector/processor.rs:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) crates/koharu-app/src/commands/canvas.rs:155 — crates/koharu-app/src/commands/canvas.rs:155-161 | crates/koharu-app/src/commands/canvas.rs:181-187 | crates/koharu-app/src/commands/canvas.rs:275-283 — 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/koharu-app/src/commands/canvas.rs:155` 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.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) crates/koharu-diffusion/src/image.rs:57 — crates/koharu-diffusion/src/image.rs:57-64 | crates/koharu-diffusion/src/image.rs:73-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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/koharu-diffusion/src/image.rs:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) crates/koharu-scene/src/edit.rs:97 — crates/koharu-scene/src/edit.rs:97-104 | crates/koharu-scene/src/edit.rs:173-180 | crates/koharu-scene/src/edit.rs:220-227 | crates/koharu-scene/src/edit.rs:699-706 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn ensure_text_group(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) crates/koharu-llama/src/context/kv_cache.rs:58 — crates/koharu-llama/src/context/kv_cache.rs:58-64 | crates/koharu-llama/src/context/kv_cache.rs:92-98 | crates/koharu-llama/src/context/kv_cache.rs:144-150 | crates/koharu-llama/src/context/kv_cache.rs:180-186 | crates/koharu-llama/src/context/kv_cache.rs:214-220 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:411 — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:411-417 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:355-361 | crates/koharu-renderer/src/bubble.rs:248-253 — before extracting anything, compare `crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs` and `crates/koharu-ml/src/pp_ocr_v6/det/processor.rs` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 317 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:411` 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.
D4 · Code Duplication · Duplicated block (3–7 lines × 4) · ×1
  • Duplicated block (3–7 lines × 4) crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:147 — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:147-149 | crates/koharu-ml/src/comic_layout_yolo26s/processor.rs:151-155 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:171-173 | crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs:175-181 — `crates/koharu-ml/src/comic_layout_yolo26s/processor.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 13 separate duplicated blocks between them, totalling at least 163 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×1
  • Duplicated block (6 lines × 3) crates/koharu-torch/src/vision/inception.rs:53 — crates/koharu-torch/src/vision/inception.rs:53-58 | crates/koharu-torch/src/vision/inception.rs:97-102 | crates/koharu-torch/src/vision/inception.rs:148-154 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-torch/src/vision/inception.rs:53` 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.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) crates/koharu-renderer/src/layout.rs:914 — crates/koharu-renderer/src/layout.rs:914-919 | crates/koharu-renderer/src/layout.rs:1150-1153 | crates/koharu-renderer/src/layout.rs:1221-1226 — 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/koharu-renderer/src/layout.rs:914` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) crates/koharu-ml/src/pp_doclayout_v3/processor.rs:69 — crates/koharu-ml/src/pp_doclayout_v3/processor.rs:69-71 | crates/koharu-ml/src/pp_ocr_v6/det/processor.rs:72-76 | crates/koharu-ml/src/pp_ocr_v6/rec/processor.rs:82-86 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 16) · ×1
  • Duplicated block (5 lines × 16) crates/koharu-ml/src/aot_inpainting/model.rs:47 — crates/koharu-ml/src/aot_inpainting/model.rs:47-51 | crates/koharu-ml/src/comic_layout_yolo26s/model.rs:40-44 | crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:38-42 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:81-85 | crates/koharu-ml/src/comic_text_bubble_detector/model.rs:38-42 | crates/koharu-ml/src/font_detector/model.rs:39-43 | crates/koharu-ml/src/hayai_ocr/model.rs:71-75 | crates/koharu-ml/src/lama/model.rs:31-35 | crates/koharu-ml/src/manga_ocr/model.rs:65-69 | crates/koharu-ml/src/manga_text_mask/model.rs:44-48 | crates/koharu-ml/src/paddle_ocr_vl/model.rs:59-63 | crates/koharu-ml/src/pp_doclayout_v3/model.rs:39-43 | crates/koharu-ml/src/pp_ocr_v6/det/model.rs:44-48 | crates/koharu-ml/src/pp_ocr_v6/rec/model.rs:37-41 | crates/koharu-ml/src/speech_bubble_yolo11n/model.rs:40-44 | crates/koharu-ml/src/speech_bubble_yolov8m/model.rs:37-41 — `crates/koharu-ml/src/comic_layout_yolo26s/model.rs` and `crates/koharu-ml/src/speech_bubble_yolo11n/model.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 19 separate duplicated blocks between them, totalling at least 229 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn load(&mut` in one and `&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) crates/koharu-ml/src/comic_layout_yolo26s/config.rs:20 — crates/koharu-ml/src/comic_layout_yolo26s/config.rs:20-24 | crates/koharu-ml/src/pp_doclayout_v3/processor.rs:59-63 | crates/koharu-ml/src/speech_bubble_yolo11n/config.rs:23-27 | crates/koharu-ml/src/speech_bubble_yolov8m/config.rs:23-27 — `crates/koharu-ml/src/speech_bubble_yolo11n/config.rs` and `crates/koharu-ml/src/speech_bubble_yolov8m/config.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 5 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `path` to `impl AsRef<Path>` in one and `impl AsRef<std::path::Path>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:383 — crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:383-396 | crates/koharu-ml/src/comic_onomatopoeia/recognizer/model.rs:759-772 | crates/koharu-ml/src/comic_text_detector/model.rs:852-865 | crates/koharu-ml/src/manga_text_mask/model.rs:576-589 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/koharu-ml/src/comic_onomatopoeia/detector/model.rs:383` 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.
D5 · Coupling · Unstable project koharu-app · ×1
  • Unstable project koharu-app — koharu-app has instability 0.92 with 1 dependents.
D5 · Coupling · Unstable project koharu-pipeline · ×1
  • Unstable project koharu-pipeline — koharu-pipeline has instability 0.86 with 1 dependents.
D8 · Code Coverage · Coverage not measured · ×1
  • Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — packages/koharu/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
R10 · Code Duplication · Duplication concentrated across 5 sibling directories (8 clone groups) · ×1
  • Duplication concentrated across 5 sibling directories (8 clone groups) packages/koharu/components/controls/OutputPicker.tsx:130 — 8 duplicated blocks under packages/koharu/components/ have copies in at least two of the sibling directories app, controls, editor, preferences, start — 3 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 8 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplicated block with local edits (203 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (203 matched lines × 2 locations) packages/ui/src/components/context-menu.tsx:37 — packages/ui/src/components/context-menu.tsx:37 · packages/ui/src/components/dropdown-menu.tsx:28 — the two spans are one implementation copied and then locally edited — 707 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (76 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (76 matched lines × 2 locations) packages/ui/src/components/dialog.tsx:10 — packages/ui/src/components/dialog.tsx:10 · packages/ui/src/components/sheet.tsx:10 — the two spans are one implementation copied and then locally edited — 336 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (54 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (54 matched lines × 2 locations) packages/ui/src/components/combobox.tsx:93 — packages/ui/src/components/combobox.tsx:93 · packages/ui/src/components/select.tsx:64 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (33 lines × 3 locations) · ×1
  • Duplicated block (33 lines × 3 locations) packages/ui/src/components/drawer.tsx:163 — packages/ui/src/components/drawer.tsx:163 · packages/ui/src/components/popover.tsx:46 · packages/ui/src/components/sheet.tsx:79 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (29 lines × 2 locations) · ×1
  • Duplicated block (29 lines × 2 locations) packages/ui/src/components/carousel.tsx:174 — packages/ui/src/components/carousel.tsx:174 · packages/ui/src/components/carousel.tsx:204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) packages/koharu/components/editor/PageRail.tsx:328 — packages/koharu/components/editor/PageRail.tsx:328 · packages/koharu/components/start/StartView.tsx:107 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (17 lines × 2 locations) · ×1
  • Duplicated block (17 lines × 2 locations) packages/ui/src/components/context-menu.tsx:27 — packages/ui/src/components/context-menu.tsx:27 · packages/ui/src/components/hover-card.tsx:13 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×1
  • Duplicated block (16 lines × 2 locations) packages/koharu/components/preferences/GenerationPreferences.tsx:38 — packages/koharu/components/preferences/GenerationPreferences.tsx:38 · packages/koharu/components/preferences/GenerationPreferences.tsx:54 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×1
  • Duplicated block (15 lines × 2 locations) packages/ui/src/components/button-group.tsx:25 — packages/ui/src/components/button-group.tsx:25 · packages/ui/src/components/field.tsx:72 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (14 lines × 11 locations) · ×1
  • Duplicated block (14 lines × 11 locations) packages/ui/src/components/accordion.tsx:11 — packages/ui/src/components/accordion.tsx:11 · packages/ui/src/components/avatar.tsx:23 · packages/ui/src/components/combobox.tsx:165 · packages/ui/src/components/combobox.tsx:185 · +7 more site(s) not listed — the 11 copies are spread across 10 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (14 lines × 17 locations) · ×1
  • Duplicated block (14 lines × 17 locations) packages/ui/src/components/alert.tsx:37 — packages/ui/src/components/alert.tsx:37 · packages/ui/src/components/attachment.tsx:83 · packages/ui/src/components/avatar.tsx:73 · packages/ui/src/components/breadcrumb.tsx:19 · +13 more site(s) not listed — the 17 copies are spread across 13 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (14 lines × 18 locations) · ×1
  • Duplicated block (14 lines × 18 locations) packages/ui/src/components/alert.tsx:32 — packages/ui/src/components/alert.tsx:32 · packages/ui/src/components/attachment.tsx:75 · packages/ui/src/components/avatar.tsx:68 · packages/ui/src/components/breadcrumb.tsx:14 · +14 more site(s) not listed — the 18 copies are spread across 13 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×1
  • Duplicated block (13 lines × 2 locations) packages/koharu/components/editor/ActivityCenter.tsx:90 — packages/koharu/components/editor/ActivityCenter.tsx:90 · packages/koharu/components/editor/ActivityCenter.tsx:183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (10 lines × 3 locations) · ×1
  • Duplicated block (10 lines × 3 locations) packages/koharu/components/editor/AgentPanel.tsx:157 — packages/koharu/components/editor/AgentPanel.tsx:157 · packages/koharu/components/editor/Inspector.tsx:297 · packages/koharu/components/preferences/SettingsPage.tsx:288 — the 3 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication · Duplicated block (10 lines × 2 locations) · ×1
  • Duplicated block (10 lines × 2 locations) packages/ui/src/components/item.tsx:61 — packages/ui/src/components/item.tsx:61 · packages/ui/src/components/marker.tsx:23 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (8 lines × 3 locations) · ×1
  • Duplicated block (8 lines × 3 locations) packages/ui/src/components/alert-dialog.tsx:4 — packages/ui/src/components/alert-dialog.tsx:4 · packages/ui/src/components/dialog.tsx:6 · packages/ui/src/components/sheet.tsx:6 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (6 lines × 2 locations) · ×1
  • Duplicated block (6 lines × 2 locations) packages/bridge/src/canvas.ts:258 — packages/bridge/src/canvas.ts:258 · packages/koharu/components/editor/useCanvas.ts:173 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 33, cognitive 38) · ×1
  • Complex function (anonymous) (cyclomatic 33, cognitive 38) packages/koharu/components/editor/CanvasWorkspace.tsx:601 — (anonymous) has cyclomatic complexity 33 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function TypeInspector (cyclomatic 27, cognitive 26) · ×1
  • Complex function TypeInspector (cyclomatic 27, cognitive 26) packages/koharu/components/editor/Inspector.tsx:131 — TypeInspector has cyclomatic complexity 27 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function layerFrame (cyclomatic 21, cognitive 23) · ×1
  • Complex function layerFrame (cyclomatic 21, cognitive 23) packages/koharu/lib/geometry.ts:65 — layerFrame has cyclomatic complexity 21 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function SettingsPage (cyclomatic 21, cognitive 19) · ×1
  • Complex function SettingsPage (cyclomatic 21, cognitive 19) packages/koharu/components/preferences/SettingsPage.tsx:58 — SettingsPage has cyclomatic complexity 21 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function RuntimeSelector (cyclomatic 20, cognitive 17) · ×1
  • Complex function RuntimeSelector (cyclomatic 20, cognitive 17) packages/koharu/components/editor/InferenceControl.tsx:86 — RuntimeSelector has cyclomatic complexity 20 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function down (cyclomatic 19, cognitive 20) · ×1
  • Complex function down (cyclomatic 19, cognitive 20) packages/koharu/components/editor/CanvasWorkspace.tsx:343 — down has cyclomatic complexity 19 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 18, cognitive 13) · ×1
  • Complex function (anonymous) (cyclomatic 18, cognitive 13) REDACTED:202 — (anonymous) has cyclomatic complexity 18 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function finishGesture (cyclomatic 17, cognitive 22) · ×1
  • Complex function finishGesture (cyclomatic 17, cognitive 22) packages/koharu/components/editor/CanvasWorkspace.tsx:503 — finishGesture has cyclomatic complexity 17 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function Updater (cyclomatic 17, cognitive 16) · ×1
  • Complex function Updater (cyclomatic 17, cognitive 16) packages/koharu/components/app/Updater.tsx:31 — Updater has cyclomatic complexity 17 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 17, cognitive 16) · ×1
  • Complex function (anonymous) (cyclomatic 17, cognitive 16) packages/koharu/components/controls/ModelPicker.tsx:112 — (anonymous) has cyclomatic complexity 17 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function moveGesture (cyclomatic 16, cognitive 15) · ×1
  • Complex function moveGesture (cyclomatic 16, cognitive 15) packages/koharu/components/editor/CanvasWorkspace.tsx:431 — moveGesture has cyclomatic complexity 16 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function TitleBar (cyclomatic 16, cognitive 14) · ×1
  • Complex function TitleBar (cyclomatic 16, cognitive 14) packages/koharu/components/app/TitleBar.tsx:40 — TitleBar has cyclomatic complexity 16 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CanvasWorkspace (cyclomatic 16, cognitive 13) · ×1
  • Complex function CanvasWorkspace (cyclomatic 16, cognitive 13) packages/koharu/components/editor/CanvasWorkspace.tsx:91 — CanvasWorkspace has cyclomatic complexity 16 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function AgentPanel (cyclomatic 14, cognitive 16) · ×1
  • Complex function AgentPanel (cyclomatic 14, cognitive 16) packages/koharu/components/editor/AgentPanel.tsx:38 — AgentPanel has cyclomatic complexity 14 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function replaceStage (cyclomatic 14, cognitive 14) · ×1
  • Complex function replaceStage (cyclomatic 14, cognitive 14) packages/koharu/components/preferences/models.ts:59 — replaceStage has cyclomatic complexity 14 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ModelPicker (cyclomatic 13, cognitive 10) · ×1
  • Complex function ModelPicker (cyclomatic 13, cognitive 10) packages/koharu/components/controls/ModelPicker.tsx:18 — ModelPicker has cyclomatic complexity 13 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 12, cognitive 18) · ×1
  • Complex function (anonymous) (cyclomatic 12, cognitive 18) packages/koharu/components/editor/CanvasWorkspace.tsx:763 — (anonymous) has cyclomatic complexity 12 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function getPayloadConfigFromPayload (cyclomatic 12, cognitive 11) · ×1
  • Complex function getPayloadConfigFromPayload (cyclomatic 12, cognitive 11) REDACTED:330 — getPayloadConfigFromPayload has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function scriptRank (cyclomatic 12, cognitive 10) · ×1
  • Complex function scriptRank (cyclomatic 12, cognitive 10) packages/koharu/components/controls/FontPicker.tsx:510 — scriptRank has cyclomatic complexity 12 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 12, cognitive 9) · ×1
  • Complex function (anonymous) (cyclomatic 12, cognitive 9) packages/koharu/components/editor/CanvasWorkspace.tsx:305 — (anonymous) has cyclomatic complexity 12 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function prefetchCanvasPages (cyclomatic 11, cognitive 17) · ×1
  • Complex function prefetchCanvasPages (cyclomatic 11, cognitive 17) packages/bridge/src/canvas.ts:246 — prefetchCanvasPages has cyclomatic complexity 11 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function selectLayer (cyclomatic 11, cognitive 12) · ×1
  • Complex function selectLayer (cyclomatic 11, cognitive 12) packages/koharu/components/editor/Inspector.tsx:552 — selectLayer has cyclomatic complexity 11 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function JobItem (cyclomatic 11, cognitive 10) · ×1
  • Complex function JobItem (cyclomatic 11, cognitive 10) packages/koharu/components/editor/ActivityCenter.tsx:104 — JobItem has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function LayerRow (cyclomatic 11, cognitive 10) · ×1
  • Complex function LayerRow (cyclomatic 11, cognitive 10) packages/koharu/components/editor/Inspector.tsx:643 — LayerRow has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function GenerationPreferences (cyclomatic 11, cognitive 10) · ×1
  • Complex function GenerationPreferences (cyclomatic 11, cognitive 10) packages/koharu/components/preferences/GenerationPreferences.tsx:13 — GenerationPreferences has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function TranslationPreferences (cyclomatic 11, cognitive 10) · ×1
  • Complex function TranslationPreferences (cyclomatic 11, cognitive 10) packages/koharu/components/preferences/TranslationPreferences.tsx:32 — TranslationPreferences has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function CanvasOverlay (cyclomatic 11, cognitive 9) · ×1
  • Complex function CanvasOverlay (cyclomatic 11, cognitive 9) packages/koharu/components/editor/CanvasOverlay.tsx:33 — CanvasOverlay has cyclomatic complexity 11 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · packages/koharu/components/editor/Inspector.tsx · ×1
  • packages/koharu/components/editor/Inspector.tsx: 1022 lines of code packages/koharu/components/editor/Inspector.tsx:1 — packages/koharu/components/editor/Inspector.tsx has 1022 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/koharu/components/editor/CanvasWorkspace.tsx · ×1
  • packages/koharu/components/editor/CanvasWorkspace.tsx: 978 lines of code packages/koharu/components/editor/CanvasWorkspace.tsx:1 — packages/koharu/components/editor/CanvasWorkspace.tsx has 978 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/ui/src/components/sidebar.tsx · ×1
  • packages/ui/src/components/sidebar.tsx: 674 lines of code packages/ui/src/components/sidebar.tsx:1 — packages/ui/src/components/sidebar.tsx has 674 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/koharu/components/editor/PageRail.tsx · ×1
  • packages/koharu/components/editor/PageRail.tsx: 555 lines of code packages/koharu/components/editor/PageRail.tsx:1 — packages/koharu/components/editor/PageRail.tsx has 555 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/koharu/components/controls/FontPicker.tsx · ×1
  • packages/koharu/components/controls/FontPicker.tsx: 520 lines of code packages/koharu/components/controls/FontPicker.tsx:1 — packages/koharu/components/controls/FontPicker.tsx has 520 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/koharu/components/editor/InferenceControl.tsx · ×1
  • packages/koharu/components/editor/InferenceControl.tsx: 433 lines of code packages/koharu/components/editor/InferenceControl.tsx:1 — packages/koharu/components/editor/InferenceControl.tsx has 433 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~7 LoC) · ×1
  • Dead file (~7 LoC) packages/koharu/instrumentation-client.ts — no import path from any entry point (71 application, 6 tooling, 14 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unused dependency '@actions/artifact' · ×1
  • Unused dependency '@actions/artifact' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'fflate' · ×1
  • Unused dependency 'fflate' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'git-cliff' · ×1
  • Unused dependency 'git-cliff' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'release-please' · ×1
  • Unused dependency 'release-please' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Minor — 44 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×19
  • Duplicated predicate crates/koharu-app/src/commands/canvas.rs:323 — `!diameter.is_finite() || diameter <= 0.0 || points.is_empty()` appears character-identically in 2 files — crates/koharu-app/src/commands/canvas.rs, crates/koharu-app/src/commands/project.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/koharu-app/src/commands/project.rs:388 — `!point.x.is_finite() || !point.y.is_finite()` appears character-identically in 3 files — crates/koharu-app/src/commands/project.rs, crates/koharu-canvas/src/web.rs, crates/koharu-renderer/src/bubble.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/koharu-ml/src/pp_ocr_v6/det/processor.rs:67 — `!self.do_convert_rgb && image.color().channel_count() < 3` appears character-identically in 2 files — crates/koharu-ml/src/pp_ocr_v6/det/processor.rs, crates/koharu-ml/src/pp_ocr_v6/rec/processor.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/koharu-canvas/src/web.rs:78 — `[self.x, self.y, self.width, self.height, self.angle_degrees] .into_iter() .all(f32::is_finite) && self.width > 0.0 && self.height > 0.0` appears character-identically in 3 files — crates/koharu-canvas/src/web.rs, crates/koharu-desktop/src/lib.rs, crates/koharu-rasterizer/src/prepared.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/koharu-pipeline/src/stages/detection.rs:1430 — `f64::from(x + 1) <= bounds.x || f64::from(y + 1) <= bounds.y || f64::from(x) >= bounds.x + bounds.width || f64::from(y) >= bounds.y + bounds…` appears character-identically in 2 files — crates/koharu-pipeline/src/stages/detection.rs, crates/koharu-pipeline/src/stages/inpainting.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/koharu-app/src/commands/output.rs:180 — `image.width() == 0 || image.height() == 0` appears character-identically in 4 files — crates/koharu-app/src/commands/output.rs, crates/koharu-ml/src/baberu_ocr/processor.rs, crates/koharu-ml/src/hayai_ocr/processor.rs, crates/koharu-ml/src/manga_ocr/processor.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/koharu-ml/src/comic_layout_yolo26s/processor.rs:52 — `image.width() == letterbox.resized_width && image.height() == letterbox.resized_height` appears character-identically in 3 files — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs, crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs, crates/koharu-ml/src/speech_bubble_yolov8m/processor.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/koharu-ml/src/speech_bubble_yolo11n/processor.rs:360 — `kept.label_id != candidate.label_id || box_iou(kept.bbox, candidate.bbox) <= nms_threshold` appears character-identically in 2 files — crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs, crates/koharu-ml/src/speech_bubble_yolov8m/processor.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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:408 — `lower.len() >= 2 && cross(lower[lower.len() - 2], lower[lower.len() - 1], point) <= 0.0` appears character-identically in 2 files — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs, crates/koharu-ml/src/pp_ocr_v6/det/processor.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/koharu-ml/src/comic_layout_yolo26s/processor.rs:205 — `original_width == 0 || original_height == 0` appears character-identically in 4 files — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs, crates/koharu-ml/src/comic_text_detector/processor.rs, crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs, crates/koharu-ml/src/speech_bubble_yolov8m/processor.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/koharu-canvas/src/web.rs:840 — `presentation.visible && presentation.opacity.is_finite() && presentation.opacity > 0.0` appears character-identically in 2 files — crates/koharu-canvas/src/web.rs, crates/koharu-rasterizer/src/frame.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/koharu-renderer/src/script.rs:43 — `script == IcuScript::Common || script == IcuScript::Inherited` appears character-identically in 2 files — crates/koharu-renderer/src/script.rs, crates/koharu-renderer/src/shape.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/koharu-ml/src/pp_doclayout_v3/processor.rs:104 — `self.image_mean.len() != 3 || self.image_std.len() != 3` appears character-identically in 3 files — crates/koharu-ml/src/pp_doclayout_v3/processor.rs, crates/koharu-ml/src/pp_ocr_v6/det/processor.rs, crates/koharu-ml/src/pp_ocr_v6/rec/processor.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/koharu-ml/src/comic_layout_yolo26s/processor.rs:265 — `self.width == 0 || self.height == 0 || self.pixels.is_empty()` appears character-identically in 3 files — crates/koharu-ml/src/comic_layout_yolo26s/processor.rs, crates/koharu-ml/src/speech_bubble_yolo11n/processor.rs, crates/koharu-ml/src/speech_bubble_yolov8m/processor.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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:417 — `upper.len() >= 2 && cross(upper[upper.len() - 2], upper[upper.len() - 1], point) <= 0.0` appears character-identically in 2 files — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs, crates/koharu-ml/src/pp_ocr_v6/det/processor.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/koharu-renderer/src/frame.rs:159 — `width > MAX_SURFACE_DIMENSION || height > MAX_SURFACE_DIMENSION || u64::from(width) * u64::from(height) > MAX_SURFACE_PIXELS` appears character-identically in 2 files — crates/koharu-renderer/src/frame.rs, crates/koharu-renderer/src/renderer.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/koharu-canvas/src/web.rs:1957 — `width > f64::from(u32::MAX) || height > f64::from(u32::MAX)` appears character-identically in 2 files — crates/koharu-canvas/src/web.rs, crates/koharu-renderer/src/renderer.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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:164 — `x == 0 || y == 0 || x > width || y > height` appears character-identically in 2 files — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs, crates/koharu-ml/src/pp_ocr_v6/det/processor.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/koharu-ml/src/comic_onomatopoeia/detector/processor.rs:595 — `x0 >= 0 && y0 >= 0 && x0 < width as i32 && y0 < height as i32` appears character-identically in 2 files — crates/koharu-ml/src/comic_onomatopoeia/detector/processor.rs, crates/koharu-ml/src/pp_ocr_v6/det/processor.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.
X7 · Silent fallback defaults · Pending state with no failure state · ×5
  • Pending state with no failure state packages/koharu/components/preferences/SettingsPage.tsx:205 — The view draws `<LoadingPreferences/>` under `pipeline`, but `pipeline` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state packages/koharu/components/preferences/SettingsPage.tsx:211 — The view draws `<LoadingPreferences/>` under `providers`, but `providers` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state packages/koharu/components/preferences/SettingsPage.tsx:231 — The view draws `<LoadingPreferences/>` under `typesetting`, but `typesetting` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state packages/koharu/components/app/TitleBar.tsx:97 — The view draws `<LoaderCircle class="animate-spin" aria-hidden="true"/>` under `importing`, but `importing` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state packages/koharu/components/app/TitleBar.tsx:117 — The view draws `<LoaderCircle class="animate-spin" aria-hidden="true"/>` under `exporting`, but `exporting` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
X4 · Structured logging · Interpolated log message defeats structured logging · ×4
  • Interpolated log message defeats structured logging crates/koharu-diffusion/src/callbacks.rs:212 — `debug!` at line 212 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: `debug!(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/koharu-diffusion/src/callbacks.rs:214 — `info!` at line 214 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/koharu-diffusion/src/callbacks.rs:215 — `warn!` at line 215 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/koharu-diffusion/src/callbacks.rs:216 — `error!` at line 216 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: `error!(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`.
D30 · Dependency Vulnerabilities · Low CVE · ×2
  • REDACTED
  • REDACTED
X7 · Silent fallback defaults · Silent fallback default on Err · ×2
  • Silent fallback default on Err crates/koharu-llama/src/gguf/mod.rs:43 — `find_key` turns every `Err` into `-1` — 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 crates/koharu-pipeline/src/resources/linux.rs:78 — `sample_drm` 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.
D10 · Test Quality · Mock-dominated test · ×1
  • Mock-dominated test: lets a cached canvas frame paint before synchronizing native page state packages/koharu/tests/components/editor-components.test.tsx:563 — This test sets up 3 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found packages/koharu/package.json:8 — 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 `packages/koharu/package.json` makes this repository a deployable product (line 8).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 27 project(s) overshoot their size bounds, lowering Project Cohesion to 9.3/10. The most over is `crates/koharu-ml` (30239 LoC, 177 module-visible types across 26 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • 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.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 15/17 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `crates/koharu-bindgen`, `packages/koharu`.
P4 · Deployment & Rollback · No release approval gate · ×1
  • 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.
R7 · Dead Code · Unused export 'dispatch' · ×1
  • Unused export 'dispatch' packages/koharu/lib/backend.ts:31 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused module-local declaration 'clamp' · ×1
  • Unused module-local declaration 'clamp' packages/koharu/components/editor/ToolBar.tsx:181 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
X5 · Nullable reference types · Strict null checking is not enabled everywhere the repository type-checks · ×1
  • Strict null checking is not enabled everywhere the repository type-checks — 3/4 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
X5 · Nullable reference types · Null assertions (`!`) override strict null checking · ×1
  • Null assertions (`!`) override strict null checking — ~0.6 `!` null assertions per 1k TypeScript source lines — 11 assertion(s) across the 17646 source line(s) of the 114 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: packages/koharu/components/editor/CanvasWorkspace.tsx (6), packages/koharu/components/editor/Inspector.tsx (3), packages/koharu/components/editor/CanvasCommandBar.tsx (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Minor — 9 finding(s)
D12 · Dependency Hygiene · Outdated · ×9
  • Outdated: icu_normalizer — `icu_normalizer` is locked at 2.3.0 but 2.4.0 is the current stable release on crates.io, and it already satisfies the `"2.3.0"` requirement declared in crates/koharu-renderer/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p icu_normalizer` and commit the updated REDACTED.
  • Outdated: icu_properties — `icu_properties` is locked at 2.3.0 but 2.4.0 is the current stable release on crates.io, and it already satisfies the `"2.3.0"` requirement declared in crates/koharu-ml/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p icu_properties` and commit the updated REDACTED.
  • Outdated: icu_segmenter — `icu_segmenter` is locked at 2.3.0 but 2.4.0 is the current stable release on crates.io, and it already satisfies the `"2.3.0"` requirement declared in crates/koharu-renderer/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p icu_segmenter` and commit the updated REDACTED.
  • Outdated: js-sys — `js-sys` is locked at 0.3.106 but 0.3.107 is the current stable release on crates.io, and it already satisfies the `"0.3.106"` requirement declared in crates/koharu-canvas/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p js-sys` and commit the updated REDACTED.
  • Outdated: libloading — `libloading` is locked at 0.9.0 but 0.9.1 is the current stable release on crates.io, and it already satisfies the `"0.9.0"` requirement declared in crates/koharu-diffusion-sys/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libloading` and commit the updated REDACTED.
  • Outdated: sentry — `sentry` is locked at 0.49.3 but 0.49.5 is the current stable release on crates.io, and it already satisfies the `"0.49.3"` requirement declared in crates/koharu/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p sentry` and commit the updated REDACTED.
  • Outdated: wasm-bindgen — `wasm-bindgen` is locked at 0.2.129 but 0.2.130 is the current stable release on crates.io, and it already satisfies the `"0.2.129"` requirement declared in crates/koharu-canvas/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen` and commit the updated REDACTED.
  • Outdated: wasm-bindgen-futures — `wasm-bindgen-futures` is locked at 0.4.79 but 0.4.80 is the current stable release on crates.io, and it already satisfies the `"0.4.79"` requirement declared in crates/koharu-canvas/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p wasm-bindgen-futures` and commit the updated REDACTED.
  • Outdated: web-sys — `web-sys` is locked at 0.3.106 but 0.3.107 is the current stable release on crates.io, and it already satisfies the `"0.3.106"` requirement declared in crates/koharu-canvas/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p web-sys` and commit the updated REDACTED.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-462dbd6910e04b0fb9637ea742e48666/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-462dbd6910e04b0fb9637ea742e48666/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .47artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .56artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—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 6 file(s) — `packages/koharu/components/editor/CanvasWorkspace.tsx`, `packages/koharu/components/editor/ToolBar.tsx`, `packages/koharu/components/preferences/PipelinePreferences.tsx`, `packages/koharu/components/preferences/models.ts`, `packages/koharu/lib/i18n.ts`, … (+1 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—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.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1db6b-7700-7420-900e-b3464108eccd · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md