Public report of Chethan616/Artefact, published 17 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive 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, 17 November 2026, 07:12 UTC · Survey ID cd_61eec97cb55441e6a8cd73adc422590a

Chethan616/Artefact

Measured 17 November 2026, 07:10 UTC, at code version 6ba7783

First survey, so nothing to compare with yet
CAI score 59.6out of 100 At risk

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A large codebase: 223,460 lines of product code in 38 projects, tests not counted · Estimated rebuild effort: about 1.8 person-years · Weakest lens: Maturity, 45.5

Findings by how serious they are

13 critical 1390 serious 164 minor

18 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 07:10 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 ▸

52of 52 dimensions measured by tools.
1435of 1567 findings point to an exact file and line, so you can open each one in the code. The other 132 concern the repository as a whole, such as missing documentation.
52dimensions across 6 lenses, read from 223,460 lines of product code in 38 projects.
Chapters

Executive summary

Chethan616/Artefact is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because the documentation refers to links that don't exist and the project keeps no record of its design decisions. It scores 59.6 out of 100, which the At risk rating leaves unchanged.

Maturity, at 45.5, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 12.6 points. Bringing the documentation in line with the code comes next, worth about 9.1 points. Raising Maturity to 70 would lift the score to about 68.5.

Eleven pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One known security hole in a package the code depends on can be used by attackers, and one password or key is open to anyone who can read the repository. Pinning each tool to an exact version, updating the vulnerable packages and replacing the exposed password or key would close these risks.

The product code is 223,460 lines, about €270,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.
Maturity 45.5 · counts for 46%Production Readiness 58.1 · counts for 25%Code Health 79.3 · counts for 14%Security and Compliance 82.0 · counts for 8%Architecture 95.7 · counts for 4%Performance 100.0 · counts for 2%

If Maturity rose from 45.5 to 70, the lowest score rated Strong, the score would rise from 59.6 to about 68.5.

Code composition: what the lines of code are
Product code 90%Tests 10%
Rebuild cost: about €270,000 · Estimate
Cost to rebuild€89,000 to €450,000, for 1,477 to 4,685 hours of work, about 1.8 person-years for 1 to 4 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.8 at a score of 60. 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: 223,460 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
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.
Raises the score by about 12.6 points · Low effort · ADR Quality
2
Reconcile the README with reality: engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist; engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist; engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist.
Raises the score by about 9.1 points · Medium effort · Documentation accuracy
3
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.
Raises the score by about 7.4 points · Medium effort · Architecture documentation

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 €270,000 to build again, about 1.8 person-years of work. Its weakest lens is Maturity, at 45.5 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 12.6 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 12% on every change. The history of the code shows how much it changes: about 314,476 lines over the last 90 days, which is about 1,275,375 lines a year. At that pace, the extra work comes to an estimated 176 to 1055.9 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 pdfcraft-a11y pdfcraft-a11y pdfcraft-content pdfcraft-content pdfcraft-a11y->pdfcraft-content pdfcraft-cos pdfcraft-cos pdfcraft-a11y->pdfcraft-cos pdfcraft-fonts pdfcraft-fonts pdfcraft-a11y->pdfcraft-fonts pdfcraft-model pdfcraft-model pdfcraft-a11y->pdfcraft-model pdfcraft-annot pdfcraft-annot pdfcraft-annot->pdfcraft-cos pdfcraft-annot->pdfcraft-fonts pdfcraft-annot->pdfcraft-model pdfcraft-audit pdfcraft-audit pdfcraft-audit->pdfcraft-content pdfcraft-audit->pdfcraft-cos pdfcraft-edit pdfcraft-edit pdfcraft-audit->pdfcraft-edit pdfcraft-audit->pdfcraft-model pdfcraft-automation pdfcraft-automation pdfcraft-automation->pdfcraft-cos pdfcraft-engine pdfcraft-engine pdfcraft-automation->pdfcraft-engine pdfcraft-organize pdfcraft-organize pdfcraft-automation->pdfcraft-organize pdfcraft-render pdfcraft-render pdfcraft-automation->pdfcraft-render pdfcraft-content->pdfcraft-cos pdfcraft-create pdfcraft-create pdfcraft-create->pdfcraft-cos pdfcraft-create->pdfcraft-fonts pdfcraft-create->pdfcraft-model pdfcraft-edit->pdfcraft-annot pdfcraft-edit->pdfcraft-content pdfcraft-edit->pdfcraft-cos pdfcraft-edit->pdfcraft-fonts pdfcraft-edit->pdfcraft-model pdfcraft-engine->pdfcraft-a11y pdfcraft-engine->pdfcraft-annot pdfcraft-engine->pdfcraft-audit pdfcraft-engine->pdfcraft-cos pdfcraft-engine->pdfcraft-create pdfcraft-engine->pdfcraft-edit pdfcraft-engine->pdfcraft-fonts pdfcraft-forms pdfcraft-forms pdfcraft-engine->pdfcraft-forms pdfcraft-measure pdfcraft-measure pdfcraft-engine->pdfcraft-measure pdfcraft-engine->pdfcraft-model pdfcraft-optimize pdfcraft-optimize pdfcraft-engine->pdfcraft-optimize pdfcraft-engine->pdfcraft-organize pdfcraft-preflight pdfcraft-preflight pdfcraft-engine->pdfcraft-preflight pdfcraft-redact pdfcraft-redact pdfcraft-engine->pdfcraft-redact pdfcraft-engine->pdfcraft-render pdfcraft-sign pdfcraft-sign pdfcraft-engine->pdfcraft-sign pdfcraft-xfdf pdfcraft-xfdf pdfcraft-engine->pdfcraft-xfdf pdfcraft-fonts->pdfcraft-cos pdfcraft-forms->pdfcraft-content pdfcraft-forms->pdfcraft-cos pdfcraft-forms->pdfcraft-fonts pdfcraft-forms->pdfcraft-model pdfcraft-measure->pdfcraft-annot pdfcraft-measure->pdfcraft-content pdfcraft-measure->pdfcraft-cos pdfcraft-measure->pdfcraft-model pdfcraft-model->pdfcraft-cos pdfcraft-optimize->pdfcraft-annot pdfcraft-optimize->pdfcraft-content pdfcraft-optimize->pdfcraft-cos pdfcraft-optimize->pdfcraft-model pdfcraft-organize->pdfcraft-content pdfcraft-organize->pdfcraft-cos pdfcraft-preflight->pdfcraft-content pdfcraft-preflight->pdfcraft-cos pdfcraft-preflight->pdfcraft-model pdfcraft-redact->pdfcraft-annot pdfcraft-redact->pdfcraft-content pdfcraft-redact->pdfcraft-cos pdfcraft-redact->pdfcraft-edit pdfcraft-redact->pdfcraft-fonts pdfcraft-redact->pdfcraft-forms pdfcraft-redact->pdfcraft-model pdfcraft-render->pdfcraft-cos pdfcraft-render->pdfcraft-fonts pdfcraft-sign->pdfcraft-annot pdfcraft-sign->pdfcraft-cos pdfcraft-sign->pdfcraft-fonts pdfcraft-sign->pdfcraft-model pdfcraft-xfdf->pdfcraft-annot pdfcraft-xfdf->pdfcraft-cos pdfcraft-xfdf->pdfcraft-forms pdfcraft-xfdf->pdfcraft-model __more__ +17 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.

692 modules, with 1436 dependencies between them. 20 loops run through 120 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 652 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 hayro_interpret.cache2 hayro_jbig23 pdfcraft_cos.object4 pdfcraft_create.office.xlsx5 vello_common.filter_effects6 vello_common.pixmap7 com.chethan616.clearpdf.ui.viewer8 hayro_syntax.object.dict9 hayro_syntax.object.name10 lopdf.object11 pdfcraft_content12 pdfcraft_cos.document13 vello_common.paint14 wordcraft_engine.session15 com.chethan616.clearpdf.ui16 hayro_syntax.content17 lopdf.document18 pdfcraft_cos.budget19 vello_common.encode20 wordcraft_engine21 hayro_syntax.object.stream22 vello_cpu.fine23 hayro_syntax.xref24 hayro_syntax.reader25 hayro_syntax.byte_reader26 hayro_syntax.object.string27 hayro_syntax.object28 pdfcraft_edit.text29 pdfcraft_forms30 pdfcraft_render.inspect31 pdfcraft_render.raster32 hayro_syntax.page33 pdfcraft_engine34 hayro_interpret.color35 hayro_interpret.font36 pdfcraft_automation37 hayro_interpret.soft_mask38 hayro_interpret.pattern39 hayro_interpret.interpret.state40 hayro_interpret.context
1 hayro_interpret.cache
2 hayro_jbig2
3 pdfcraft_cos.object
4 pdfcraft_create.office.xlsx
5 vello_common.filter_effects
6 vello_common.pixmap
7 com.chethan616.clearpdf.ui.viewer45
8 hayro_syntax.object.dict734
9 hayro_syntax.object.name1323
10 lopdf.object1
11 pdfcraft_content4
12 pdfcraft_cos.document8
13 vello_common.paint2
14 wordcraft_engine.session2
15 com.chethan616.clearpdf.ui24
16 hayro_syntax.content11322
17 lopdf.document3
18 pdfcraft_cos.budget31
19 vello_common.encode6
20 wordcraft_engine1
21 hayro_syntax.object.stream21324
22 vello_cpu.fine2243
23 hayro_syntax.xref31522
24 hayro_syntax.reader222
25 hayro_syntax.byte_reader2
26 hayro_syntax.object.string1323
27 hayro_syntax.object1111721
28 pdfcraft_edit.text672211
29 pdfcraft_forms10224
30 pdfcraft_render.inspect310
31 pdfcraft_render.raster2
32 hayro_syntax.page4122231
33 pdfcraft_engine3134254
34 hayro_interpret.color633131
35 hayro_interpret.font331212
36 pdfcraft_automation31124
37 hayro_interpret.soft_mask1112322
38 hayro_interpret.pattern41111231123
39 hayro_interpret.interpret.state1113121
40 hayro_interpret.context21111113
Uses a module listed above itPart of a loopThe module itself
1 hayro_interpret.cache2 hayro_jbig23 pdfcraft_cos.object4 pdfcraft_create.office.xlsx5 vello_common.filter_effects6 vello_common.pixmap7 com.chethan616.clearpdf.ui.viewer8 hayro_syntax.object.dict9 hayro_syntax.object.name10 lopdf.object11 pdfcraft_content12 pdfcraft_cos.document13 vello_common.paint14 wordcraft_engine.session15 com.chethan616.clearpdf.ui16 hayro_syntax.content17 lopdf.document18 pdfcraft_cos.budget19 vello_common.encode20 wordcraft_engine21 hayro_syntax.object.stream22 vello_cpu.fine23 hayro_syntax.xref24 hayro_syntax.reader25 hayro_syntax.byte_reader26 hayro_syntax.object.string27 hayro_syntax.object28 pdfcraft_edit.text29 pdfcraft_forms30 pdfcraft_render.inspect31 pdfcraft_render.raster32 hayro_syntax.page33 pdfcraft_engine34 hayro_interpret.color35 hayro_interpret.font36 pdfcraft_automation37 hayro_interpret.soft_mask38 hayro_interpret.pattern39 hayro_interpret.interpret.state40 hayro_interpret.contexthayro_interpret.cache1hayro_jbig22pdfcraft_cos.object3pdfcraft_create.office.xlsx4vello_common.filter_effects5vello_common.pixmap6com.chethan616.clearpdf.ui.viewer7hayro_syntax.object.dict8hayro_syntax.object.name9lopdf.object10pdfcraft_content11pdfcraft_cos.document12vello_common.paint13wordcraft_engine.session14com.chethan616.clearpdf.ui15hayro_syntax.content16lopdf.document17pdfcraft_cos.budget18vello_common.encode19wordcraft_engine20hayro_syntax.object.stream21vello_cpu.fine22hayro_syntax.xref23hayro_syntax.reader24hayro_syntax.byte_reader25hayro_syntax.object.string26hayro_syntax.object27pdfcraft_edit.text28pdfcraft_forms29pdfcraft_render.inspect30pdfcraft_render.raster31hayro_syntax.page32pdfcraft_engine33hayro_interpret.color34hayro_interpret.font35pdfcraft_automation36hayro_interpret.soft_mask37hayro_interpret.pattern38hayro_interpret.interpret.state39hayro_interpret.context4045734132314822241132233161213242243315222222132311117216722111022431024122231313425463313133121231124111232241111231123111312121111113+652 more modules (most-connected shown)

At a glance — Code Health · 79.3 · Adequate · gated by D1, D2 ·

At a glance — Architecture · 95.7 · Exemplary ·

At a glance — Maturity · 45.5 · Weak · gated by M2, M4 ·

At a glance — Readiness · 58.1 · Adequate ·

At a glance — Security · 82.0 · Checked 5 of 11 · gated by D36 ·

At a glance — Performance · 100.0 · 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 Failures15High / Critical
A05:2025 — Injection12High / Critical
A07:2025 — Authentication Failures2High / Critical

Roadmap

Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml; Reconcile the README with reality: engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist; engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist; engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist; 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.

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

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml.+12.6 ptsLowADR Quality
Reconcile the README with reality: engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist; engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist; engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist.+9.1 ptsMediumDocumentation accuracy
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.+7.4 ptsMediumArchitecture documentation
Resolve the 62 Hotspot finding(s) in Churn × Complexity Hotspots — start with lib.rs (7), text.rs (3), appearance.rs (2).+2.5 ptsHighChurn × Complexity Hotspots
Enable Dependabot/Renovate or a dependency-review gate.+1.4 ptsMediumSecurity & performance tooling
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+1.4 ptsMediumRelease Hygiene
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.+1.0 ptsMediumObservability
Bring the 199 bodies over 30 down to 30 or less in Cognitive Complexity — start with pdfcraft_create::office::xlsx::draw_sheet (cognitive 342), pdfcraft_edit::text_regions::rewrite_styled_block (cognitive 305), PhotoEditorKt.PhotoEditScreen (cognitive 275).+0.9 ptsHighCognitive Complexity

File quality

Per-file score 0–10 — a quality signature. Of 236 files carrying findings, judged against the Production bar: 0% slop · 80% mixed · 20% near-clean.

FileScoreBandWorst signal
REDACTED3.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
engine/crates/automation/src/lib.rs7.0MixedCyclomatic Complexity: Automation::call (cyclomatic 256)
engine/crates/js/src/formcalc.rs7.0MixedCyclomatic Complexity: Interp::builtin_inner (cyclomatic 157)
engine/crates/engine/src/lib.rs7.0MixedCyclomatic Complexity: pdfcraft_engine::run_edit (cyclomatic 144)
engine/crates/edit/src/text_regions.rs7.0MixedCyclomatic Complexity: pdfcraft_edit::text_regions::rewrite_styled_block (cyclomatic 142)
engine/crates/annot/src/appearance.rs7.0MixedCyclomatic Complexity: pdfcraft_annot::appearance::build (cyclomatic 123)
engine/crates/create/src/office/xlsx.rs7.0MixedCyclomatic Complexity: pdfcraft_create::office::xlsx::draw_sheet (cyclomatic 116)
android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt7.0MixedCyclomatic Complexity: SheetViewerKt.drawSheet (cyclomatic 105)
engine/crates/forms/src/author.rs7.0MixedCyclomatic Complexity: pdfcraft_forms::author::set_props (cyclomatic 103)
engine/crates/edit/src/text.rs7.0MixedCyclomatic Complexity: pdfcraft_edit::text::rewrite_block_from (cyclomatic 100)
android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt7.0MixedCyclomatic Complexity: MindMapKt.MindMapEditor (cyclomatic 75)
engine/crates/redact/src/interp.rs7.0MixedCyclomatic Complexity: pdfcraft_redact::interp::process_from (cyclomatic 70)
engine/crates/preflight/src/lib.rs7.0MixedCyclomatic Complexity: pdfcraft_preflight::verify (cyclomatic 64)
engine/crates/xfa/src/pdf.rs7.0MixedCyclomatic Complexity: Emitter::widget (cyclomatic 58)
engine/crates/render/src/text.rs7.0MixedCyclomatic Complexity: pdfcraft_render::text::arrange (cyclomatic 56)
engine/crates/annot/src/lib.rs7.0MixedCyclomatic Complexity: pdfcraft_annot::add_annotation (cyclomatic 54)
engine/crates/sign/src/pdf.rs7.0MixedCyclomatic Complexity: pdfcraft_sign::pdf::classify_changes (cyclomatic 53)
engine/crates/create/src/office/docx.rs7.0MixedCyclomatic Complexity: Converter::table (cyclomatic 51)

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

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

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

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

Could not be resolved — 18

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 52 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 — 52 dimensions across the health lenses
D1D2D3D4D5D6D12D13D14D15D17D19D20D26D28D29D30D34D35D36D37D43D44AX10AX3AX4AX9GD1IC1M1M2M3M4P1P10P2P3P4P6PF3X1X12X16X17X18X21X25X27X28X29X30X5

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, 1435 of 1567 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 01a1e858-0bee-76db-8d2c-1726f9c0beaf.

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.

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in engine was stopped before it finished (TimedOut). Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .kt) and this repository declares a Cargo test suite (engine, 183 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D12 Dependency Hygiene — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Currency was graded against Maven Central, but whether an artifact is DEPRECATED is not: Maven Central publishes no deprecation marker, exactly as rubygems.org does not. Whether one is UNMAINTAINED is not graded either — no registry publishes a maintenance status, and release age does not stand in for one. Two of this dimension's four signals are therefore unread on a Gradle tree, and its score reflects currency alone.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Gradle build (build.gradle/build.gradle.kts), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Gradle dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D15 Churn × Complexity Hotspots — 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. A hotspot's complexity is meant to be the worst body its churn actually touched. For app/src/main/java/com/chethan616/clearpdf/MainActivity.kt that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
  • 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 (11 contributor(s) across 474 commit(s) sampled, automation and bot accounts excluded). One of them holds 87% of the history; the other 10 hold 1.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.
  • 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 per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — 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 the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt`, `android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt`, `android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt`, `android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt`, `android/app/src/main/java/com/chethan616/clearpdf/ui/FreeTextLayout.kt`, … (+9 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.
  • 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. Boot via AndroidApp (android/app). the Android app did not build — `./gradlew :app:assembleDebug` exited 1: an exception. * What went wrong: Execution failed for task ':app:cargoBuildDebug' (registered by plugin 'com.android.internal.application'). > Error while evaluating property 'ndkDir' of task ':app:c…; runtime evidence skipped (launch chosen because android/app/build.gradle.kts applies the Android application plugin and android/gradlew builds it).
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • 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.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X19 Unrestored process-global state — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.

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.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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.
  • 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 Complexity2.0 / 10Critical✓ 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 2.0 / 10 · rule-coverage 100% · ceiling Prevented

328 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Automation::call at 256. A further 20 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 FreeTextLayout.width at 44 — they are counted neither in the figure above nor in this dimension's score. 6 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: android/app/src/main/java/com/chethan616/clearpdf/ui/FreeTextLayout.kt (FreeTextLayout.width at 44), android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentTypes.kt (DocumentTypes.mimeOf at 35), android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt (QuickToolsKt.runQuickTool at 24), engine/crates/organize/src/attachments.rs (pdfcraft_organize::attachments::mime_for_name at 22), android/app/src/main/java/com/chethan616/clearpdf/ui/desk/ToolsScreen.kt (ToolsScreenKt.toneOf at 17), and 1 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

pdfcraft_edit::text_regions::rewrite_styled_block (cyclomatic 142) · ×22engine/crates/edit/src/text_regions.rs:437
pdfcraft_create::office::xlsx::draw_sheet (cyclomatic 116) · ×21engine/crates/create/src/office/xlsx.rs:918
pdfcraft_forms::author::set_props (cyclomatic 103) · ×20engine/crates/forms/src/author.rs:1160
pdfcraft_xfa::data::merge (cyclomatic 40) · ×17engine/crates/xfa/src/data.rs:935
pdfcraft_redact::interp::process_from (cyclomatic 70) · ×13engine/crates/redact/src/interp.rs:801

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

What to do

  1. Bring the 6 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with Automation::call (cyclomatic 256), Interp::builtin_inner (cyclomatic 157), PhotoEditorKt.PhotoEditScreen (cyclomatic 146). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cyclomatic Complexity from 2.0 to about 3.1/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D2 · Cognitive Complexity2.0 / 10Critical✓ 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 2.0 / 10 · rule-coverage 100% · ceiling Prevented

545 method(s) exceeded the cognitive complexity threshold of 15; the worst was pdfcraft_create::office::xlsx::draw_sheet at 342.

pdfcraft_edit::text_regions::rewrite_styled_block (cognitive 305) · ×48engine/crates/edit/src/text_regions.rs:437
pdfcraft_forms::author::set_props (cognitive 176) · ×38engine/crates/forms/src/author.rs:1160
pdfcraft_create::office::xlsx::draw_sheet (cognitive 342) · ×27engine/crates/create/src/office/xlsx.rs:918
pdfcraft_redact::interp::process_from (cognitive 161) · ×22engine/crates/redact/src/interp.rs:801
pdfcraft_xfa::pdf::strip (cognitive 62) · ×22engine/crates/xfa/src/pdf.rs:1105

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

What to do

  1. Bring the 199 bodies over 30 down to 30 or less in Cognitive Complexity — start with pdfcraft_create::office::xlsx::draw_sheet (cognitive 342), pdfcraft_edit::text_regions::rewrite_styled_block (cognitive 305), PhotoEditorKt.PhotoEditScreen (cognitive 275). — 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 199 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.

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

D3 · God Classes8.4 / 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 8.4 / 10 · rule-coverage 100% · ceiling Prevented

133 god class(es) detected.

FileTooLong: src/lib.rs · ×53engine/crates/engine/src/lib.rs
FunctionTooLong: pdfcraft_automation::tools::tools · ×34engine/crates/automation/src/tools.rs:120
MethodTooLong: PhotoEditorKt.PhotoEditScreen · ×28android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:274
ClassTooLong: AppViewModel · ×9android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:71
TooManyMethods: AppViewModel · ×7android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:71

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

What to do

  1. Resolve the 53 FileTooLong finding(s) in God Classes — start with lib.rs (11), pdf.rs (3), text.rs (2). — One of this dimension's main actionable groups (53 warning-level).
  2. Resolve the 34 FunctionTooLong finding(s) in God Classes — start with lib.rs (9), appearance.rs (3), text.rs (3). — One of this dimension's main actionable groups (34 warning-level).
  3. Resolve the 28 MethodTooLong finding(s) in God Classes — start with lib.rs (4), SheetViewer.kt (3), PhotoEditor.kt. — One of this dimension's main actionable groups (28 warning-level).

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

D4 · Code Duplication9.2 / 10Stronggated by 260 serious findings✓ 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 9.2 / 10 · rule-coverage 100% · ceiling Verified

138 duplicated block group(s) detected. 2.0 % of the production lines (4,461 of 223,460) are in a reported copy. A further 122 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 1 of the 260 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (5 lines × 2) · ×31engine/crates/automation/src/lib.rs:1487
Duplicated block (6 lines × 2) · ×28engine/crates/edit/src/flatten.rs:401
Edited copy of a member (3 corresponding lines) · ×14engine/crates/a11y/src/content.rs:169
Duplicated block (8 lines × 2) · ×11engine/crates/annot/src/lib.rs:745
Duplicated block (9 lines × 2) · ×10engine/crates/annot/src/lib.rs:2350

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

What to do

  1. Resolve the 31 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with lib.rs (12), document.rs (3), tags.rs (2). — One of this dimension's main actionable groups (31 warning-level).
  2. Resolve the 28 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with pdf.rs (4), pptx.rs (2), text_regions.rs (2). — One of this dimension's main actionable groups (28 warning-level).
  3. Resolve the 14 Edited copy of a member (3 corresponding lines) finding(s) in Code Duplication — start with content.rs (2), lib.rs (2), appearance.rs (2). — One of this dimension's main actionable groups (14 warning-level).

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

D5 · Coupling6.1 / 10Adequate✓ 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 6.1 / 10 · rule-coverage 100% · ceiling Prevented

37 production modules (Gradle+Cargo), 0 dependency cycle(s), 5 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 12 module(s) off the main sequence, with abstractness counted on 35 of the 37 (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: pdfcraft-compare · ×12
Unstable project pdfcraft-a11y
Unstable project pdfcraft-automation
Unstable project pdfcraft-engine
Unstable project pdfcraft-optimize

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

What to do

  1. Resolve the 12 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (12 warning-level).
  2. Resolve the 1 Unstable project pdfcraft-a11y finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project pdfcraft-automation 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 / 10Stronggated by 1 serious finding✓ 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

1 of 365 classes have LCOM4 above 3.

Low cohesion: u32x8 (LCOM4 5)engine/vendor/hayro-jbig2/src/simd.rs:30

What to do

  1. Resolve the 1 Low cohesion finding(s) in Cohesion (LCOM4) — start with simd.rs. — One of this dimension's main actionable groups (1 warning-level).

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

D12 · Dependency Hygiene8.0 4.1 / 10Weak✓ 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 4.1 / 10 · rule-coverage 51% · ceiling Verified

This repository's Gradle dependency graph was RESOLVED BY A BUILD, across every subproject rather than the root alone: 265 artifact(s) resolved, 136 of them gradable against Maven Central, and 107 behind a shipped release. Where a version was requested and a different one won conflict resolution, the RESOLVED version is what is graded — grading the request would recommend an upgrade already applied. Known CVEs in the same graph are a separate question again, reported under D30.

Outdated (compile): com.google.guava:guava · ×107

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

D13 · REDACTED 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

REDACTED 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 610 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 45 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 a Gradle build (build.gradle/build.gradle.kts), and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.9 / 10Strong✓ 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 8.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt (27×116=3132); android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt (12×146=1752); android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt (13×105=1365)

Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt · ×62android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:95

What to do

  1. Resolve the 62 Hotspot finding(s) in Churn × Complexity Hotspots — start with lib.rs (7), text.rs (3), appearance.rs (2). — One of this dimension's main actionable groups (62 warning-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ 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

1 deducted task-comment markers across 223460 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.

TodoCommentandroid/backdrop/src/main/java/com/kyant/backdrop/backdrops/LayerBackdrop.kt:67

What to do

  1. Resolve the 1 TodoComment finding(s) in Explicit Debt — start with LayerBackdrop.kt. — 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

1 of 1 documentation facets pass in full. 28 document(s) read across 1 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 foundengine/mobile/bindgen/Cargo.toml:9

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with Cargo.toml. — One of this dimension's main actionable groups (1 recommendation-level).

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

D26 · Project Cohesion9.5 / 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.5 / 10 · rule-coverage 100% · ceiling Documented

1 of 38 build units (Cargo, Gradle, checkout) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesionandroid/app/build.gradle.kts:1

✓ On the Gold path — maintain.

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

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

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

1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

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

D29 · Static Analysis (SAST)9.5 / 10Adequategated by 11 critical findings✓ 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 9.5 / 10 · rule-coverage 100% · ceiling Documented

12 finding(s): 0 critical, 11 high, 1 medium, 0 low. 11 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 7 file(s) — `android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt` (line 85), `android/gradlew` (line 74, line 180), `engine/crates/cos/src/document.rs` (lines 1195–1223, line 1223), `engine/crates/create/src/office/tests.rs`, `engine/crates/forms/src/af.rs` (line 1129, line 1135, line 1148), … (+2 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

What to do

  1. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  2. No action in Static Analysis (SAST) — all 11 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 (11 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities6.9 / 10Adequate✓ 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 6.9 / 10 · rule-coverage 100% · ceiling Documented

11 finding(s): 1 critical, 0 high, 10 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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 333 of the 357 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 / 10Exemplary✓ 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

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.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 recommendation-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.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.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 2 platform declaration(s) and 12 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.

AX10 · Code composition9.9 / 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.

GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unreviewed-generation residue in this repository's Rust: functions whose whole body is still `todo!()`/`unimplemented!()` or only panics with a "not implemented" message, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.

IC1 · Incompleteness & stubs7.7 / 10Strong✓ Tool-verified

Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's Rust: functions whose body is `todo!()`/`unimplemented!()` or only panics with a "not implemented" message, match arms and branches left as `todo!()`, functions that take inputs and return a constant (`Ok(())`, `None`, `Default::default()`, an empty `Vec`) or do nothing, and impls most of whose methods are holes.

Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.

  • `read` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. (×3) — engine/crates/measure/src/lib.rs:187, engine/crates/measure/src/lib.rs:197, engine/crates/measure/src/lib.rs:210
  • `sign_inner` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. — engine/crates/sign/src/pdf.rs:2239
  • `timestamp_document` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. — engine/crates/sign/src/pdf.rs:2295
  • `locate` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled. — engine/crates/sign/src/pdf.rs:2307

What to do

  • Remove the dead code that looks live: delete dead if(false) branches, which read as logic that runs, and either do the real async work or drop the async keyword from fake-async functions, which promise work they never wait for.
M1 · Documentation (README)9.3 / 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.

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

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.

  • engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/automation/README.md:42
  • engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/automation/README.md:174
  • engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/automation/README.md:193
  • engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/automation/README.md:194
  • engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/engine/README.md:7
  • engine/crates/fonts/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — engine/crates/fonts/README.md:91

What to do

  • Reconcile the README with reality: engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist; engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist; engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist; engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist.
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 · Observability6.0 / 10Adequate✓ 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 2/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `engine/mobile/bindgen`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling5.0 / 10Adequate✓ 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.

  • `engine/Cargo.toml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — engine/Cargo.toml:13

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback7.0 / 10Strong✓ 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.

P6 · Release Hygiene5.0 / 10Adequate✓ 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.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
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.

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.

X12 · Unreachable branch8.0 / 10Strong✓ Tool-verified

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

  • `let r = parse_uri(uri).ok_or(( INVALID_PARAMS, format !("unknown resource {ur…` follows `{ let content = self.automation.call(tool, & json !({ })).map_err(| e |(INVAL…` (line 497) in the same block, and control never passes that statement — it returns, breaks, continues, panics, exits or calls a function that never returns. This code cannot run for any input; rustc warns `unreachable_code` on it. Delete it, or move it before the statement that leaves if it was meant to run. — engine/crates/automation/src/mcp.rs:508

What to do

  • Each finding names the span that makes the branch dead and the span it is dead because of. Confirm from the two, then delete the dead arm or fix the predicate that was meant to be reachable.
X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. 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 `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document1.7 / 10Critical✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `count` is public and takes a `DataNode` as its receiver from its caller, and it calls itself at line 46 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `count` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/xfa/src/data.rs:46
  • `apply` is public, takes a document from its caller (line 3960) and hands it to `uses_scripts`, which calls itself at line 275 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `uses_scripts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:275
  • `apply` is public, takes a document from its caller (line 3960) and hands it to `scope_of`, which calls itself at line 324 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `scope_of` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:324
  • `permissions` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 714 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `permissions` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:714
  • `text_blocks` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 585 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `text_blocks` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:585
  • `revision_ends` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 924 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `revision_ends` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:924
  • `repair_log` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 935 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `repair_log` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:935
  • `label` is public and takes a `Edit` as its receiver from its caller, and it calls itself at line 2221 with a piece of the document (and at line 2222) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `label` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:2221
  • `apply` is public, takes a document from its caller (line 3960) and hands it to `check_permission`, which calls itself at line 2449 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `check_permission` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:2449
  • `apply` is public, takes a document from its caller (line 3960) and hands it to `run_edit`, which calls itself at line 3003 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `run_edit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:3003
  • `apply` is public, takes a document from its caller (line 3960) and hands it to `keys_after`, which calls itself at line 3064 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `keys_after` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/engine/src/lib.rs:3064
  • `iter` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 172 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `iter` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:172
  • `get` is public and takes a `Dict` as its receiver from its caller, and it recurses at line 131 through `position` and back with a piece of the document (and at line 121, line 123) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `get` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:131
  • `get_mut` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 136 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `get_mut` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:136
  • `len` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 176 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `len` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:176
  • `remove` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 161 with a piece of the document (and at line 164) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `remove` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:161
  • `is_empty` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 180 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `is_empty` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/object.rs:180
  • `transform` is public, takes a document from its caller (line 155) and hands it to `walk`, which calls itself at line 168 with a piece of the document (and at line 173, line 177, line 179) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/security.rs:168
  • `serialize` is public and takes `o: &Object` from its caller, and it recurses at line 38 through `write_stream`, `write_dict` and back with a piece of the document (and at line 42, line 43, line 120, line 128) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `serialize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — engine/crates/cos/src/writer.rs:38

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X18 · Disposal-pattern correctness5.6 / 10Adequate✓ Tool-verified

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

  • `rgba.into_raw()` (line 60) gives up ownership in exchange for a raw handle — the value's `Drop` will no longer run — and nothing in the crate's code ever reclaims a `image` from a raw pointer (`image::from_raw`). The memory or descriptor stays allocated until the process ends, once per call. Pair the hand-out with its reclaim (a `free` function that rebuilds the owner with `from_raw` and drops it), or keep the owning value. — engine/crates/engine/src/copy_image.rs:60
  • `img.into_raw()` (line 477) gives up ownership in exchange for a raw handle — the value's `Drop` will no longer run — and nothing in the crate's code ever reclaims a `image` from a raw pointer (`image::from_raw`). The memory or descriptor stays allocated until the process ends, once per call. Pair the hand-out with its reclaim (a `free` function that rebuilds the owner with `from_raw` and drops it), or keep the owning value. — engine/crates/create/src/extract.rs:477

What to do

  • Each finding names the value and the span that decides who owns it — the `new` that created it, or the constructor parameter that handed it over. Confirm ownership from that span, then make the disposal match it: release what this type created, leave what it was injected with to whoever created THAT, and drop a finalizer whose type holds nothing unmanaged to release.
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.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for (x in c)` or `c.forEach { … }` leaves the collection it is walking alone — a `mutableListOf`/`ArrayList`, `mutableMapOf`/`HashMap` or `mutableSetOf`/`HashSet` is a `java.util` collection on the JVM and is walked by its own fail-fast iterator, so a body that adds to or removes from the very collection the loop is walking makes the next step throw `ConcurrentModificationException` and the remaining elements are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

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.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X5 · Nullable reference types10.0 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether Rust's absent values are handled rather than forced — `Option` and `Result` make absence a value the caller must handle in every crate, and each `.unwrap()` or `.expect()` that no guard on its path proves present is a panic the first time the value is `None` or `Err`.

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

  • `a.parse()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `oid` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — engine/crates/sign/src/der.rs:446
  • `e.write_all(data)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `encode` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — engine/crates/filters/src/flate.rs:79
  • `e.finish()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `encode` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`). — engine/crates/filters/src/flate.rs:80

What to do

  • Each row is a forced `Option`/`Result` no guard on its path proves present. Handle the absent case where it arises rather than forcing it: `?` to hand it to the caller, `if let` / `match` / `let … else` to branch on it, `unwrap_or` / `unwrap_or_default` / `unwrap_or_else` where a default is right. Where the value genuinely cannot be absent, say so in a way a reader can check from the line: test it first (`if x.is_none() { return … }`), look the key up with `contains_key` or the index against `len()`, or construct the value so it cannot be absent.

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 Health79.3Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture95.7ExemplarySolid.
Maturity45.5Weak — gated by M2, M4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness58.1AdequateAcceptable, with room to improve.
Security82.0Checked 5 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance100.0ExemplaryStrongest area.
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 — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 31 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 59 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Kotlin 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.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Kotlin code is a Spring, JSR-330 or CDI singleton bean. 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.
  • 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 16% of this repository's production lines — rust (187,072 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 Android app did not build — `./gradlew :app:assembleDebug` exited 1: an exception. * What went wrong: Execution failed for task ':app:cargoBuildDebug' (registered by plugin 'com.android.internal.application'). > Error while evaluating property 'ndkDir' of task ':app:c…; runtime evidence skipped (launch chosen because android/app/build.gradle.kts applies the Android application plugin and android/gradlew builds it) This is a statement about this run, not a statement about your application: nothing here says the app is inaccessible, only that it was never run.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~25994 lines of test source are present (.rs, .kt) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-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: 2 candidate(s) found and not reported.
  • D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (engine), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .kt, .py, .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • 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) — 14 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — Rust suite
  • DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 146 value object(s)
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (1 aggregate(s) with Apply/When folds)
  • 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 JVM, 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
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `#[bench]`, criterion's `bench_function`/`bench_with_input`, `#[divan::bench]` or `#[library_benchmark]` in any `.rs` file, or criterion, divan, iai or a `[[bench]]` target in a Cargo.toml, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • 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
  • X19 Unrestored process-global state — X19 reached only 16% of this repository's production lines — rust (187,072 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X2 Cancellation propagation — 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
  • X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not 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
  • 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
  • X3 Exception handling — X3 reached only 16% of this repository's production lines — rust (187,072 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Rust was read, and it logs through none: the `log` crate's macros take one finished message (as log4net does in C#; its `kv` values are an opt-in its backends mostly drop), `println!`/`eprintln!` are not loggers, or it makes no log call outside its tests and examples at all. Calls through `tracing` (`tracing::info!`, or `info!` imported from it) would be judged.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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 — 13 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×1
  • REDACTED
Serious — 1390 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×62
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:95 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in ViewerScreenKt.ViewerScreen at line 95. 1 of those changes was a fix/bug commit, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:274 — android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 146 in PhotoEditorKt.PhotoEditScreen at line 274. 3 of those changes were fix/bug commits, and the other 9 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1105 — android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in SheetViewerKt.drawSheet at line 1105. 2 of those changes were fix/bug commits, and the other 11 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt`: 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: engine/crates/automation/src/lib.rs engine/crates/automation/src/lib.rs:204 — engine/crates/automation/src/lib.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 256 in Automation::call at line 204. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/automation/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:619 — android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in AppViewModel.viewerKey at line 619. 1 of those changes was a fix/bug commit, and the other 37 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-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt`: 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: engine/crates/engine/src/lib.rs engine/crates/engine/src/lib.rs:2548 — engine/crates/engine/src/lib.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 144 in pdfcraft_engine::run_edit at line 2548. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/engine/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt:139 — android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in ClearAppKt.Shell at line 139. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:632 — android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in ToolScreensKt.CropScreen at line 632. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt`: 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: engine/crates/annot/src/appearance.rs engine/crates/annot/src/appearance.rs:382 — engine/crates/annot/src/appearance.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 123 in pdfcraft_annot::appearance::build at line 382. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/annot/src/appearance.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt:104 — android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in MainActivity.collectRequests at line 104. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt:80 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in PageCanvasKt.PageCanvas at line 80. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt`: 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: engine/crates/edit/src/text.rs engine/crates/edit/src/text.rs:3035 — engine/crates/edit/src/text.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in pdfcraft_edit::text::rewrite_block_from at line 3035. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/edit/src/text.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt:108 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ViewerBarsKt.ViewerTopBar at line 108. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt`: 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: engine/crates/edit/src/text_regions.rs engine/crates/edit/src/text_regions.rs:437 — engine/crates/edit/src/text_regions.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 142 in pdfcraft_edit::text_regions::rewrite_styled_block at line 437. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/edit/src/text_regions.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt:82 — android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in FilesScreenKt.FilesScreen at line 82. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt:83 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in PagesScreenKt.PagesScreen at line 83. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt`: 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: engine/mobile/src/sheets.rs engine/mobile/src/sheets.rs:326 — engine/mobile/src/sheets.rs changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in SheetBook::cells at line 326. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/mobile/src/sheets.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: engine/crates/annot/src/lib.rs engine/crates/annot/src/lib.rs:1152 — engine/crates/annot/src/lib.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in pdfcraft_annot::add_annotation at line 1152. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/annot/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: engine/crates/forms/src/author.rs engine/crates/forms/src/author.rs:1160 — engine/crates/forms/src/author.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in pdfcraft_forms::author::set_props at line 1160. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/forms/src/author.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt:164 — android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in HomeScreenKt.HomeScreen at line 164. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt`: 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: android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt:138 — android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in QuickPreviewKt.Preview at line 138. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt`: 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: engine/mobile/src/office.rs engine/mobile/src/office.rs:90 — engine/mobile/src/office.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in artefact_mobile::office::sniff at line 90. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/mobile/src/office.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: engine/crates/sign/src/pdf.rs engine/crates/sign/src/pdf.rs:1335 — engine/crates/sign/src/pdf.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in pdfcraft_sign::pdf::classify_changes at line 1335. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/sign/src/pdf.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: engine/crates/render/src/inspect.rs engine/crates/render/src/inspect.rs:1430 — engine/crates/render/src/inspect.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in Inspector::annotations at line 1430. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- engine/crates/render/src/inspect.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:64 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ButtonsKt.glassControl at line 64. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-17..2026-11-15, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-17 23:50:57 +05:30' --until='2026-11-15 23:50:57 +05:30' --full-history --no-merges -- android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt`: 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.
  • + 37 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×53
  • FileTooLong: src/lib.rs engine/crates/engine/src/lib.rs — FileTooLong — 3471 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 61 free functions. The bar is 500 significant lines; this is 2971 over it, 6.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/text.rs engine/crates/edit/src/text.rs — FileTooLong — 2390 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 93 free functions. The bar is 500 significant lines; this is 1890 over it, 4.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: ui/AppViewModel.kt android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt — FileTooLong — 2237 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: AppViewModel (71-3567). The bar is 500 significant lines; this is 1737 over it, 4.47× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs engine/crates/automation/src/lib.rs — FileTooLong — 2116 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 82% of them inside a single declaration: Automation (3 blocks, 117-2399). The bar is 500 significant lines; this is 1616 over it, 4.23× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs engine/crates/annot/src/lib.rs — FileTooLong — 1831 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 75 free functions. The bar is 500 significant lines; this is 1331 over it, 3.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/pdf.rs engine/crates/sign/src/pdf.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), declaring 46 free functions. 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/document.rs engine/crates/cos/src/document.rs — FileTooLong — 1473 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: Document (3 blocks, 406-2219). The bar is 500 significant lines; this is 973 over it, 2.95× 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/inspect.rs engine/crates/render/src/inspect.rs — FileTooLong — 1468 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 31 free functions. The bar is 500 significant lines; this is 968 over it, 2.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/tools.rs engine/crates/automation/src/tools.rs — FileTooLong — 1271 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 771 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/data.rs engine/crates/xfa/src/data.rs — FileTooLong — 1258 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 71 free functions. The bar is 500 significant lines; this is 758 over it, 2.52× 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: sheets/SheetViewer.kt android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt — FileTooLong — 1149 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 649 over it, 2.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: src/lib.rs engine/crates/js/src/lib.rs — FileTooLong — 1148 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 53 free functions. The bar is 500 significant lines; this is 648 over it, 2.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: src/author.rs engine/crates/forms/src/author.rs — FileTooLong — 1142 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 45 free functions. The bar is 500 significant lines; this is 642 over it, 2.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs engine/crates/forms/src/lib.rs — FileTooLong — 1116 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 51 free functions. The bar is 500 significant lines; this is 616 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/text.rs engine/crates/render/src/text.rs — FileTooLong — 1099 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 599 over it, 2.20× 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/xfa.rs engine/crates/js/src/xfa.rs — FileTooLong — 1071 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 56 free functions. The bar is 500 significant lines; this is 571 over it, 2.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs engine/crates/xfdf/src/lib.rs — FileTooLong — 1069 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 39 free functions. The bar is 500 significant lines; this is 569 over it, 2.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: office/docx.rs engine/crates/create/src/office/docx.rs — FileTooLong — 1067 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 567 over it, 2.13× 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: notes/MindMap.kt android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt — FileTooLong — 1036 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 536 over it, 2.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: notes/PhotoEditor.kt android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt — FileTooLong — 1033 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 533 over it, 2.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: office/pptx.rs engine/crates/create/src/office/pptx.rs — FileTooLong — 1021 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 521 over it, 2.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/appearance.rs engine/crates/annot/src/appearance.rs — FileTooLong — 1013 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 38 free functions. The bar is 500 significant lines; this is 513 over it, 2.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: office/xlsx.rs engine/crates/create/src/office/xlsx.rs — FileTooLong — 986 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 486 over it, 1.97× 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/import.rs engine/crates/organize/src/import.rs — FileTooLong — 966 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 466 over it, 1.93× 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/interp.rs engine/crates/redact/src/interp.rs — FileTooLong — 956 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 456 over it, 1.91× 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.
  • + 28 more in this group — see findings.md.
D2 · Cognitive Complexity · pdfcraft_edit · ×48
  • pdfcraft_edit::text_regions::rewrite_styled_block (cognitive 305) engine/crates/edit/src/text_regions.rs:437 — pdfcraft_edit::text_regions::rewrite_styled_block has cognitive complexity 305 (threshold 15). Drivers by points: if/else 95 (219 pts), loops 30 (52 pts), boolean chains 30, match/switch 3 (4 pts) (nesting depth added 147). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_edit::text::interpret (cognitive 213) engine/crates/edit/src/text.rs:1199 — pdfcraft_edit::text::interpret has cognitive complexity 213 (threshold 15). Drivers by points: if/else 40 (149 pts), match/switch 10 (43 pts), loops 4 (14 pts), boolean chains 7 (nesting depth added 152). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text::rewrite_block_from (cognitive 137) engine/crates/edit/src/text.rs:3035 — pdfcraft_edit::text::rewrite_block_from has cognitive complexity 137 (threshold 15). Drivers by points: if/else 69 (92 pts), boolean chains 26, loops 5 (11 pts), match/switch 7 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::flatten::flatten_in (cognitive 91) engine/crates/edit/src/flatten.rs:163 — pdfcraft_edit::flatten::flatten_in has cognitive complexity 91 (threshold 15). Drivers by points: if/else 23 (64 pts), boolean chains 12, loops 5 (10 pts), match/switch 2 (5 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text_regions::group_layout (cognitive 64) engine/crates/edit/src/text_regions.rs:203 — pdfcraft_edit::text_regions::group_layout has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 20, loops 3 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::added::draw_laid_shaped (cognitive 54) engine/crates/edit/src/added.rs:649 — pdfcraft_edit::added::draw_laid_shaped has cognitive complexity 54 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 8 (14 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::images::page_images_in (cognitive 53) engine/crates/edit/src/images.rs:230 — pdfcraft_edit::images::page_images_in has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (43 pts), loops 2 (5 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::isolation (cognitive 47) engine/crates/edit/src/lib.rs:505 — pdfcraft_edit::isolation has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (30 pts), match/switch 4 (9 pts), boolean chains 6, loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::add_header_footer (cognitive 39) engine/crates/edit/src/lib.rs:741 — pdfcraft_edit::add_header_footer has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 4 (7 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text_reading::remove_all_text (cognitive 39) engine/crates/edit/src/text_reading.rs:428 — pdfcraft_edit::text_reading::remove_all_text has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 6 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::background::page_background (cognitive 37) engine/crates/edit/src/background.rs:47 — pdfcraft_edit::background::page_background has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 5 (15 pts), boolean chains 4, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::objects::added_geometry (cognitive 37) engine/crates/edit/src/objects.rs:156 — pdfcraft_edit::objects::added_geometry has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text::fonts_shown (cognitive 37) engine/crates/edit/src/text.rs:2080 — pdfcraft_edit::text::fonts_shown has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 5 (7 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::added::shaped_layout (cognitive 36) engine/crates/edit/src/added.rs:447 — pdfcraft_edit::added::shaped_layout has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (8 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text::translate_blocks_inlined (cognitive 35) engine/crates/edit/src/text.rs:3598 — pdfcraft_edit::text::translate_blocks_inlined has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text::text_lines_in (cognitive 34) engine/crates/edit/src/text.rs:1607 — pdfcraft_edit::text::text_lines_in has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 11, loops 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::images::reading_images::walk (cognitive 33) engine/crates/edit/src/images.rs:318 — pdfcraft_edit::images::reading_images::walk has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (32 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::images::translate_images_inlined (cognitive 33) engine/crates/edit/src/images.rs:766 — pdfcraft_edit::images::translate_images_inlined has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, loops 4, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::images::image_transform_scope (cognitive 32) engine/crates/edit/src/images.rs:552 — pdfcraft_edit::images::image_transform_scope has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (7 pts), match/switch 1 (2 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.
  • pdfcraft_edit::added::wrapped (cognitive 30) engine/crates/edit/src/added.rs:261 — pdfcraft_edit::added::wrapped has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::remove_marks (cognitive 26) engine/crates/edit/src/lib.rs:964 — pdfcraft_edit::remove_marks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (8 pts), match/switch 2 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text::wrap (cognitive 26) engine/crates/edit/src/text.rs:2930 — pdfcraft_edit::text::wrap has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::added::draw (cognitive 25) engine/crates/edit/src/added.rs:864 — pdfcraft_edit::added::draw has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_edit::bidi::reading (cognitive 25) engine/crates/edit/src/bidi.rs:171 — pdfcraft_edit::bidi::reading has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_edit::text_reading::lines_of (cognitive 25) engine/crates/edit/src/text_reading.rs:75 — pdfcraft_edit::text_reading::lines_of has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 23 more in this group — see findings.md.
D2 · Cognitive Complexity · pdfcraft_forms · ×38
  • pdfcraft_forms::author::set_props (cognitive 176) engine/crates/forms/src/author.rs:1160 — pdfcraft_forms::author::set_props has cognitive complexity 176 (threshold 15). Drivers by points: if/else 75 (130 pts), boolean chains 19, match/switch 8 (16 pts), loops 6 (11 pts) (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::appearance::field_appearance_fit (cognitive 79) engine/crates/forms/src/appearance.rs:738 — pdfcraft_forms::appearance::field_appearance_fit has cognitive complexity 79 (threshold 15). Drivers by points: if/else 34 (62 pts), loops 3 (9 pts), boolean chains 5, match/switch 3 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::detect::page_shapes (cognitive 74) engine/crates/forms/src/detect.rs:128 — pdfcraft_forms::detect::page_shapes has cognitive complexity 74 (threshold 15). Drivers by points: if/else 20 (59 pts), loops 4 (8 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_forms::af::parse_date (cognitive 65) engine/crates/forms/src/af.rs:982 — pdfcraft_forms::af::parse_date has cognitive complexity 65 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 18, match/switch 3 (6 pts), loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::write_value (cognitive 60) engine/crates/forms/src/lib.rs:1048 — pdfcraft_forms::write_value has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 7 (14 pts), boolean chains 10, loops 2 (5 pts) (nesting depth added 25). 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.
  • pdfcraft_forms::af::js_tokens (cognitive 47) engine/crates/forms/src/af.rs:504 — pdfcraft_forms::af::js_tokens has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 7 (23 pts), loops 6 (17 pts), boolean chains 4, if/else 1 (3 pts) (nesting depth added 29). 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.
  • pdfcraft_forms::rank_tabs (cognitive 41) engine/crates/forms/src/lib.rs:696 — pdfcraft_forms::rank_tabs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 8 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::af::order (cognitive 35) engine/crates/forms/src/af.rs:916 — pdfcraft_forms::af::order has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::detect::detect (cognitive 35) engine/crates/forms/src/detect.rs:354 — pdfcraft_forms::detect::detect has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 8 (9 pts), boolean chains 4, 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.
  • pdfcraft_forms::with_field_appearances_cached (cognitive 32) engine/crates/forms/src/lib.rs:1476 — pdfcraft_forms::with_field_appearances_cached has cognitive complexity 32 (threshold 15). Drivers by points: match/switch 6 (20 pts), if/else 2 (6 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 19). 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.
  • pdfcraft_forms::detect::raster::components (cognitive 32) engine/crates/forms/src/detect/raster.rs:373 — pdfcraft_forms::detect::raster::components has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 4 (10 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::actions::set_field_actions (cognitive 31) engine/crates/forms/src/actions.rs:266 — pdfcraft_forms::actions::set_field_actions has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 18). 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.
  • pdfcraft_forms::detect::raster::writing_area (cognitive 31) engine/crates/forms/src/detect/raster.rs:300 — pdfcraft_forms::detect::raster::writing_area has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, loops 3 (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.
  • pdfcraft_forms::scripting::apply_changes (cognitive 30) engine/crates/forms/src/scripting.rs:104 — pdfcraft_forms::scripting::apply_changes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 3 (10 pts), loops 3 (6 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.
  • pdfcraft_forms::scripting::document_scripts_named (cognitive 30) engine/crates/forms/src/scripting.rs:173 — pdfcraft_forms::scripting::document_scripts_named has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (4 pts), match/switch 1 (4 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.
  • pdfcraft_forms::af::calculation_sites (cognitive 28) engine/crates/forms/src/af.rs:706 — pdfcraft_forms::af::calculation_sites has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 3 (5 pts), match/switch 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::detect::raster::ink (cognitive 27) engine/crates/forms/src/detect/raster.rs:121 — pdfcraft_forms::detect::raster::ink has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 4 (6 pts), boolean chains 3 (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.
  • pdfcraft_forms::author::patch_widget_look (cognitive 26) engine/crates/forms/src/author.rs:336 — pdfcraft_forms::author::patch_widget_look has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (7 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::detect::raster::enclosed (cognitive 26) engine/crates/forms/src/detect/raster.rs:227 — pdfcraft_forms::detect::raster::enclosed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::walk (cognitive 25) engine/crates/forms/src/lib.rs:782 — pdfcraft_forms::walk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (18 pts), loops 2 (3 pts), boolean chains 2, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_forms::button_action (cognitive 24) engine/crates/forms/src/lib.rs:271 — pdfcraft_forms::button_action has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 7 (18 pts), if/else 2 (3 pts), loops 1 (3 pts) (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_forms::af::format_date (cognitive 24) engine/crates/forms/src/af.rs:1117 — pdfcraft_forms::af::format_date has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::author::add_field (cognitive 24) engine/crates/forms/src/author.rs:817 — pdfcraft_forms::author::add_field has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 7 (8 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::author::duplicate_field (cognitive 24) engine/crates/forms/src/author.rs:1630 — pdfcraft_forms::author::duplicate_field has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), match/switch 2 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_forms::adopt_page_fields (cognitive 23) engine/crates/forms/src/lib.rs:616 — pdfcraft_forms::adopt_page_fields has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 13 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×34
  • FunctionTooLong: pdfcraft_automation::tools::tools engine/crates/automation/src/tools.rs:120 — FunctionTooLong — pdfcraft_automation::tools::tools runs 1186 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 1086 over it, 11.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_edit::text_regions::rewrite_styled_block engine/crates/edit/src/text_regions.rs:437 — FunctionTooLong — pdfcraft_edit::text_regions::rewrite_styled_block runs 583 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 483 over it, 5.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_annot::appearance::build engine/crates/annot/src/appearance.rs:382 — FunctionTooLong — pdfcraft_annot::appearance::build runs 420 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 320 over it, 4.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: pdfcraft_engine::run_edit engine/crates/engine/src/lib.rs:2548 — FunctionTooLong — pdfcraft_engine::run_edit runs 333 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 233 over it, 3.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_edit::text::rewrite_block_from engine/crates/edit/src/text.rs:3035 — FunctionTooLong — pdfcraft_edit::text::rewrite_block_from runs 310 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 210 over it, 3.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.
  • FunctionTooLong: pdfcraft_edit::text::interpret engine/crates/edit/src/text.rs:1199 — FunctionTooLong — pdfcraft_edit::text::interpret runs 288 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 188 over it, 2.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_create::office::xlsx::draw_sheet engine/crates/create/src/office/xlsx.rs:918 — FunctionTooLong — pdfcraft_create::office::xlsx::draw_sheet runs 280 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 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_forms::author::set_props engine/crates/forms/src/author.rs:1160 — FunctionTooLong — pdfcraft_forms::author::set_props runs 253 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 153 over it, 2.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_redact::apply_to engine/crates/redact/src/lib.rs:377 — FunctionTooLong — pdfcraft_redact::apply_to runs 210 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 110 over it, 2.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.
  • FunctionTooLong: pdfcraft_redact::interp::process_from engine/crates/redact/src/interp.rs:801 — FunctionTooLong — pdfcraft_redact::interp::process_from runs 208 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 108 over it, 2.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_annot::add_annotation engine/crates/annot/src/lib.rs:1152 — FunctionTooLong — pdfcraft_annot::add_annotation runs 197 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 97 over it, 1.97× 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: pdfcraft_render::text::arrange engine/crates/render/src/text.rs:1491 — FunctionTooLong — pdfcraft_render::text::arrange runs 197 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 97 over it, 1.97× 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: pdfcraft_create::office::rtf::control engine/crates/create/src/office/rtf.rs:572 — FunctionTooLong — pdfcraft_create::office::rtf::control runs 189 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 89 over it, 1.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_create::office::rtf::convert engine/crates/create/src/office/rtf.rs:356 — FunctionTooLong — pdfcraft_create::office::rtf::convert runs 169 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 69 over it, 1.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_export::tables engine/crates/export/src/lib.rs:196 — FunctionTooLong — pdfcraft_export::tables runs 155 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 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: pdfcraft_js::xfa::install engine/crates/js/src/xfa.rs:1255 — FunctionTooLong — pdfcraft_js::xfa::install runs 143 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 43 over it, 1.43× 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: pdfcraft_redact::interp::xobject engine/crates/redact/src/interp.rs:1215 — FunctionTooLong — pdfcraft_redact::interp::xobject runs 143 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 43 over it, 1.43× 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: pdfcraft_forms::appearance::field_appearance_fit engine/crates/forms/src/appearance.rs:738 — FunctionTooLong — pdfcraft_forms::appearance::field_appearance_fit runs 139 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 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pdfcraft_forms::author::add_field engine/crates/forms/src/author.rs:817 — FunctionTooLong — pdfcraft_forms::author::add_field runs 128 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 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: pdfcraft_create::office::flow::render_line engine/crates/create/src/office/flow.rs:541 — FunctionTooLong — pdfcraft_create::office::flow::render_line runs 122 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 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: pdfcraft_preflight::convert engine/crates/preflight/src/lib.rs:731 — FunctionTooLong — pdfcraft_preflight::convert runs 120 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 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: pdfcraft_engine::check_permission engine/crates/engine/src/lib.rs:2317 — FunctionTooLong — pdfcraft_engine::check_permission 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.
  • FunctionTooLong: pdfcraft_edit::flatten::flatten_in engine/crates/edit/src/flatten.rs:163 — FunctionTooLong — pdfcraft_edit::flatten::flatten_in runs 117 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 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: pdfcraft_xfa::data::merge engine/crates/xfa/src/data.rs:935 — FunctionTooLong — pdfcraft_xfa::data::merge runs 117 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 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: pdfcraft_edit::text_regions::group_layout engine/crates/edit/src/text_regions.rs:203 — FunctionTooLong — pdfcraft_edit::text_regions::group_layout 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.
  • + 9 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×31
  • Duplicated block (5 lines × 2) engine/crates/automation/src/lib.rs:1487 — engine/crates/automation/src/lib.rs:1487-1491 | engine/crates/automation/src/lib.rs:2186-2190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) engine/crates/create/src/office/flow.rs:466 — engine/crates/create/src/office/flow.rs:466-470 | engine/crates/create/src/office/flow.rs:477-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) engine/crates/edit/src/images.rs:638 — engine/crates/edit/src/images.rs:638-642 | engine/crates/edit/src/images.rs:706-710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) engine/crates/engine/src/lib.rs:4744 — engine/crates/engine/src/lib.rs:4744-4748 | engine/crates/engine/src/lib.rs:4798-4802 — both copies are in the same file, so extract the 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 (5 lines × 2) engine/crates/redact/src/lib.rs:481 — engine/crates/redact/src/lib.rs:481-485 | engine/crates/redact/src/sanitize.rs:421-425 — 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 `engine/crates/redact/src/lib.rs:481` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) engine/crates/redact/src/tags.rs:173 — engine/crates/redact/src/tags.rs:173-177 | engine/crates/redact/src/tags.rs:459-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/redact/src/tags.rs:173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) engine/crates/edit/src/lib.rs:252 — engine/crates/edit/src/lib.rs:252-256 | engine/crates/print/src/lib.rs:711-715 — 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) engine/crates/print/src/lib.rs:717 — engine/crates/print/src/lib.rs:717-721 | engine/crates/xfdf/src/lib.rs:215-219 — 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) engine/crates/engine/src/signature_image.rs:160 — engine/crates/engine/src/signature_image.rs:160-164 | engine/crates/engine/src/signature_scan.rs:137-141 — 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) engine/crates/automation/src/lib.rs:1613 — engine/crates/automation/src/lib.rs:1613-1617 | engine/crates/automation/src/lib.rs:1666-1670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/automation/src/lib.rs:1613` it does not close everything it opens, so those exact lines 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) engine/crates/annot/src/lib.rs:1834 — engine/crates/annot/src/lib.rs:1834-1838 | engine/crates/annot/src/lib.rs:1891-1895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) engine/crates/edit/src/text_regions.rs:648 — engine/crates/edit/src/text_regions.rs:648-652 | engine/crates/edit/src/text_regions.rs:670-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text_regions.rs:648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) engine/crates/a11y/src/headings.rs:113 — engine/crates/a11y/src/headings.rs:113-117 | engine/crates/a11y/src/tags.rs:213-217 — 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) engine/crates/annot/src/lib.rs:1222 — engine/crates/annot/src/lib.rs:1222-1226 | engine/crates/annot/src/lib.rs:1237-1241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/annot/src/lib.rs:1222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) engine/crates/annot/src/lib.rs:2064 — engine/crates/annot/src/lib.rs:2064-2068 | engine/crates/annot/src/lib.rs:2727-2731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) engine/crates/cos/src/document.rs:484 — engine/crates/cos/src/document.rs:484-488 | engine/crates/cos/src/document.rs:1157-1161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) engine/crates/cos/src/document.rs:1643 — engine/crates/cos/src/document.rs:1643-1647 | engine/crates/cos/src/document.rs:1952-1956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/cos/src/document.rs:1643` it does not close everything it opens, so those exact lines 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) engine/crates/cos/src/document.rs:1748 — engine/crates/cos/src/document.rs:1748-1752 | engine/crates/cos/src/document.rs:2014-2018 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) engine/crates/create/src/extract.rs:76 — engine/crates/create/src/extract.rs:76-80 | engine/crates/engine/src/copy_image.rs:133-137 — 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 `engine/crates/create/src/extract.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `engine/crates/engine/src/copy_image.rs:138` calls `insert` and `engine/crates/create/src/extract.rs:81` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) engine/crates/create/src/lib.rs:469 — engine/crates/create/src/lib.rs:469-473 | engine/crates/create/src/lib.rs:475-479 — both copies are in the same file, so extract the 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 (5 lines × 2) engine/crates/edit/src/text.rs:2884 — engine/crates/edit/src/text.rs:2884-2888 | engine/crates/edit/src/text.rs:3684-3688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text.rs:2884` 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) engine/crates/edit/src/text.rs:3258 — engine/crates/edit/src/text.rs:3258-3262 | engine/crates/forms/src/author.rs:144-148 — 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) engine/crates/engine/src/lib.rs:4506 — engine/crates/engine/src/lib.rs:4506-4510 | engine/crates/engine/src/optimizer.rs:62-66 — 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) engine/crates/forms/src/author.rs:864 — engine/crates/forms/src/author.rs:864-868 | engine/crates/forms/src/author.rs:1450-1454 — both copies are in the same file, so extract the 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 (5 lines × 2) engine/crates/js/src/lib.rs:1426 — engine/crates/js/src/lib.rs:1426-1430 | engine/crates/js/src/xfa.rs:1350-1354 — 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 `engine/crates/js/src/lib.rs:1426` 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, `engine/crates/js/src/lib.rs:1424` calls `property`, `from` and `engine/crates/js/src/xfa.rs:1348` 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.
  • + 6 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×28
  • MethodTooLong: PhotoEditorKt.PhotoEditScreen android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:274 — MethodTooLong — PhotoEditScreen runs 669 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 569 over it, 6.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Automation.call engine/crates/automation/src/lib.rs:204 — MethodTooLong — call runs 659 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 559 over it, 6.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MindMapKt.MindMapEditor android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:690 — MethodTooLong — MindMapEditor runs 393 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 293 over it, 3.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SheetViewerKt.SheetViewer android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:673 — MethodTooLong — SheetViewer runs 315 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 215 over it, 3.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: ViewerScreenKt.ViewerScreen android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:95 — MethodTooLong — ViewerScreen runs 300 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 200 over it, 3.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SheetViewerKt.drawSheet android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1105 — MethodTooLong — drawSheet runs 259 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LiquidMorphKt.LiquidMorphSurface android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:182 — MethodTooLong — LiquidMorphSurface runs 190 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 90 over it, 1.90× 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: Emitter.widget engine/crates/xfa/src/pdf.rs:331 — MethodTooLong — widget runs 188 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 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SheetViewerKt.SheetGrid android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:431 — MethodTooLong — SheetGrid runs 175 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 75 over it, 1.75× 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: Automation.comment_add engine/crates/automation/src/comments.rs:247 — MethodTooLong — comment_add runs 175 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 75 over it, 1.75× 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: PagesScreenKt.PagesScreen android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt:83 — MethodTooLong — PagesScreen runs 171 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 71 over it, 1.71× 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: Document.read_compact_section engine/crates/cos/src/document.rs:1632 — MethodTooLong — read_compact_section runs 153 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: NoteEditorKt.NoteEditor android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt:107 — MethodTooLong — NoteEditor runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SheetBook.cells engine/mobile/src/sheets.rs:326 — MethodTooLong — cells 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: Session.apply engine/crates/engine/src/lib.rs:3960 — MethodTooLong — apply runs 143 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 43 over it, 1.43× 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: MorphButtonKt.RectMorphSurface android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:178 — MethodTooLong — RectMorphSurface runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Walker.ops engine/crates/measure/src/snap.rs:250 — MethodTooLong — ops runs 132 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 32 over it, 1.32× 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: CommentPanelKt.CommentPanel android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt:62 — MethodTooLong — CommentPanel 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.
  • MethodTooLong: Edit.label engine/crates/engine/src/lib.rs:2134 — MethodTooLong — label 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: Converter.table engine/crates/create/src/office/docx.rs:1283 — MethodTooLong — table 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.
  • MethodTooLong: SheetChartsKt.paintChart android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetCharts.kt:20 — MethodTooLong — paintChart 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.
  • MethodTooLong: Session.prepare_open_unguarded engine/crates/engine/src/lib.rs:3681 — MethodTooLong — prepare_open_unguarded 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: Writer.page engine/crates/create/src/office/draw.rs:439 — MethodTooLong — page 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: Renderer.text_body engine/crates/create/src/office/pptx.rs:1014 — MethodTooLong — text_body 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: Automation.redact_mark engine/crates/automation/src/redact.rs:14 — MethodTooLong — redact_mark 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.
  • + 3 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×28
  • Duplicated block (6 lines × 2) engine/crates/edit/src/flatten.rs:401 — engine/crates/edit/src/flatten.rs:401-406 | engine/crates/xfa/src/script.rs:157-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/flatten.rs:401` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) engine/crates/export/src/pptx.rs:422 — engine/crates/export/src/pptx.rs:422-427 | engine/crates/export/src/xlsx.rs:465-470 — 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 `engine/crates/export/src/pptx.rs:422` 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) engine/crates/js/src/formcalc.rs:1268 — engine/crates/js/src/formcalc.rs:1268-1273 | engine/crates/js/src/formcalc.rs:1576-1581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/js/src/formcalc.rs:1268` 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) engine/crates/sign/src/pdf.rs:2463 — engine/crates/sign/src/pdf.rs:2463-2468 | engine/crates/sign/src/pdf.rs:2480-2485 — both copies are in the same file, so extract the 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) engine/crates/xfa/src/layout.rs:1035 — engine/crates/xfa/src/layout.rs:1035-1040 | engine/crates/xfa/src/layout.rs:1081-1086 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/xfa/src/layout.rs:1035` it does not close everything it opens, so those exact lines 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) engine/crates/xfa/src/lib.rs:168 — engine/crates/xfa/src/lib.rs:168-173 | engine/crates/xfa/src/script.rs:634-639 — 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) engine/crates/automation/src/a11y.rs:525 — engine/crates/automation/src/a11y.rs:525-530 | engine/crates/automation/src/a11y.rs:543-548 — both copies are in the same file, so extract the 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) engine/crates/cos/src/document.rs:1654 — engine/crates/cos/src/document.rs:1654-1659 | engine/crates/cos/src/document.rs:1960-1965 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/cos/src/document.rs:1654` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) engine/crates/create/src/office/pptx.rs:728 — engine/crates/create/src/office/pptx.rs:728-733 | engine/crates/create/src/office/pptx.rs:735-740 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) engine/crates/edit/src/text_regions.rs:803 — engine/crates/edit/src/text_regions.rs:803-808 | engine/crates/edit/src/text_regions.rs:972-977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text_regions.rs:803` it does not close everything it opens, so those exact lines 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) engine/crates/edit/src/text_regions.rs:805 — engine/crates/edit/src/text_regions.rs:805-810 | engine/crates/edit/src/text_regions.rs:1042-1047 — both copies are in the same file, so extract the 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) engine/crates/engine/src/camera.rs:161 — engine/crates/engine/src/camera.rs:161-166 | engine/crates/engine/src/ocr.rs:185-190 — 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 `engine/crates/engine/src/camera.rs:161` 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) engine/crates/engine/src/signature_scan.rs:320 — engine/crates/engine/src/signature_scan.rs:320-325 | engine/crates/engine/src/signature_scan.rs:378-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/engine/src/signature_scan.rs:320` it does not close everything it opens, so those exact lines 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) engine/crates/organize/src/import.rs:1187 — engine/crates/organize/src/import.rs:1187-1192 | engine/crates/organize/src/import.rs:1274-1279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/organize/src/import.rs:1187` 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) engine/crates/render/src/inspect.rs:2234 — engine/crates/render/src/inspect.rs:2234-2239 | engine/crates/xfa/src/packets.rs:90-95 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/render/src/inspect.rs:2234` 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) engine/crates/edit/src/images.rs:759 — engine/crates/edit/src/images.rs:759-764 | engine/crates/edit/src/text.rs:3591-3596 — 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) engine/crates/sign/src/pdf.rs:863 — engine/crates/sign/src/pdf.rs:863-868 | engine/crates/sign/src/pdf.rs:1310-1317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/sign/src/pdf.rs:863` it does not close everything it opens, so those exact lines 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) engine/crates/annot/src/appearance.rs:503 — engine/crates/annot/src/appearance.rs:503-508 | engine/crates/annot/src/appearance.rs:577-582 — both copies are in the same file, so extract the 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) engine/crates/edit/src/added.rs:839 — engine/crates/edit/src/added.rs:839-844 | engine/crates/edit/src/text.rs:2461-2466 — 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) engine/crates/edit/src/text.rs:3439 — engine/crates/edit/src/text.rs:3439-3444 | engine/crates/edit/src/text_regions.rs:1172-1177 — 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) engine/crates/organize/src/attachments.rs:87 — engine/crates/organize/src/attachments.rs:87-92 | engine/crates/organize/src/import.rs:1283-1288 — 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 `engine/crates/organize/src/attachments.rs:87` it does not close everything it opens, so those exact lines 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) engine/crates/sign/src/cms.rs:85 — engine/crates/sign/src/cms.rs:85-90 | engine/crates/sign/src/cms.rs:130-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) engine/crates/sign/src/pdf.rs:1813 — engine/crates/sign/src/pdf.rs:1813-1818 | engine/crates/sign/src/pdf.rs:1876-1881 — both copies are in the same file, so extract the 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) engine/crates/xfa/src/pdf.rs:484 — engine/crates/xfa/src/pdf.rs:484-489 | engine/crates/xfa/src/pdf.rs:524-529 — both copies are in the same file, so extract the 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) android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt:82 — android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt:82-87 | android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt:67-72 — 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.
  • + 3 more in this group — see findings.md.
D2 · Cognitive Complexity · pdfcraft_create · ×27
  • pdfcraft_create::office::xlsx::draw_sheet (cognitive 342) engine/crates/create/src/office/xlsx.rs:918 — pdfcraft_create::office::xlsx::draw_sheet has cognitive complexity 342 (threshold 15). Drivers by points: if/else 62 (219 pts), loops 25 (79 pts), match/switch 8 (24 pts), boolean chains 20 (nesting depth added 227). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::rtf::convert (cognitive 108) engine/crates/create/src/office/rtf.rs:356 — pdfcraft_create::office::rtf::convert has cognitive complexity 108 (threshold 15). Drivers by points: if/else 29 (82 pts), loops 5 (11 pts), match/switch 3 (9 pts), boolean chains 6 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::flow::paginate (cognitive 86) engine/crates/create/src/office/flow.rs:906 — pdfcraft_create::office::flow::paginate has cognitive complexity 86 (threshold 15). Drivers by points: if/else 13 (43 pts), loops 9 (34 pts), boolean chains 7, match/switch 1 (2 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::flow::layout_para (cognitive 85) engine/crates/create/src/office/flow.rs:367 — pdfcraft_create::office::flow::layout_para has cognitive complexity 85 (threshold 15). Drivers by points: if/else 23 (47 pts), loops 6 (19 pts), match/switch 4 (14 pts), boolean chains 5 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::xlsx::format_date (cognitive 77) engine/crates/create/src/office/xlsx.rs:537 — pdfcraft_create::office::xlsx::format_date has cognitive complexity 77 (threshold 15). Drivers by points: if/else 26 (57 pts), match/switch 4 (13 pts), boolean chains 6, loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::flow::render_line (cognitive 68) engine/crates/create/src/office/flow.rs:541 — pdfcraft_create::office::flow::render_line has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27 (56 pts), match/switch 4 (6 pts), boolean chains 4, loops 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::rtf::control (cognitive 63) engine/crates/create/src/office/rtf.rs:572 — pdfcraft_create::office::rtf::control has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (50 pts), match/switch 7 (12 pts), boolean chains 1 (nesting depth added 30). 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.
  • pdfcraft_create::office::xlsx::parse_sheet (cognitive 54) engine/crates/create/src/office/xlsx.rs:762 — pdfcraft_create::office::xlsx::parse_sheet has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 5 (13 pts), boolean chains 6, match/switch 1 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::docx::convert (cognitive 53) engine/crates/create/src/office/docx.rs:670 — pdfcraft_create::office::docx::convert has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 9 (17 pts), match/switch 3, boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::docx::parse_ppr (cognitive 52) engine/crates/create/src/office/docx.rs:176 — pdfcraft_create::office::docx::parse_ppr has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (32 pts), match/switch 4 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::extract::image (cognitive 47) engine/crates/create/src/extract.rs:106 — pdfcraft_create::extract::image has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (25 pts), match/switch 6 (13 pts), boolean chains 8, loops 1 (nesting depth added 11). 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.
  • pdfcraft_create::office::xlsx::format_value (cognitive 38) engine/crates/create/src/office/xlsx.rs:356 — pdfcraft_create::office::xlsx::format_value has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::jpeg (cognitive 37) engine/crates/create/src/lib.rs:230 — pdfcraft_create::jpeg has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 7, match/switch 3 (7 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::flow::layout_table (cognitive 37) engine/crates/create/src/office/flow.rs:764 — pdfcraft_create::office::flow::layout_table has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 8 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::xlsx::format_number (cognitive 35) engine/crates/create/src/office/xlsx.rs:461 — pdfcraft_create::office::xlsx::format_number has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 8, loops 4, match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_create::office::xml::nests_deeper_than (cognitive 35) engine/crates/create/src/office/xml.rs:31 — pdfcraft_create::office::xml::nests_deeper_than has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::extract::space (cognitive 25) engine/crates/create/src/extract.rs:365 — pdfcraft_create::extract::space has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 8 (21 pts), if/else 2 (4 pts) (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_create::office::pptx::custom (cognitive 24) engine/crates/create/src/office/pptx.rs:553 — pdfcraft_create::office::pptx::custom has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::pptx::render_slide (cognitive 23) engine/crates/create/src/office/pptx.rs:717 — pdfcraft_create::office::pptx::render_slide has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 4 (7 pts), boolean chains 4, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::xlsx::sheet_images (cognitive 22) engine/crates/create/src/office/xlsx.rs:706 — pdfcraft_create::office::xlsx::sheet_images has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::extract::extract_images (cognitive 20) engine/crates/create/src/extract.rs:36 — pdfcraft_create::extract::extract_images has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::jpx (cognitive 19) engine/crates/create/src/lib.rs:191 — pdfcraft_create::jpx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::tiff_pages_within (cognitive 19) engine/crates/create/src/lib.rs:432 — pdfcraft_create::tiff_pages_within has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::docx::apply_run_props (cognitive 19) engine/crates/create/src/office/docx.rs:1449 — pdfcraft_create::office::docx::apply_run_props has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_create::office::flow::pieces (cognitive 18) engine/crates/create/src/office/flow.rs:294 — pdfcraft_create::office::flow::pieces has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 2 more in this group — see findings.md.
D1 · Cyclomatic Complexity · pdfcraft_edit · ×22
  • pdfcraft_edit::text_regions::rewrite_styled_block (cyclomatic 142) engine/crates/edit/src/text_regions.rs:437 — pdfcraft_edit::text_regions::rewrite_styled_block has cyclomatic complexity 142 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::text::rewrite_block_from (cyclomatic 100) engine/crates/edit/src/text.rs:3035 — pdfcraft_edit::text::rewrite_block_from has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::text::interpret (cyclomatic 80) engine/crates/edit/src/text.rs:1199 — pdfcraft_edit::text::interpret has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::flatten::flatten_in (cyclomatic 42) engine/crates/edit/src/flatten.rs:163 — pdfcraft_edit::flatten::flatten_in has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::text_regions::group_layout (cyclomatic 41) engine/crates/edit/src/text_regions.rs:203 — pdfcraft_edit::text_regions::group_layout has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::isolation (cyclomatic 35) engine/crates/edit/src/lib.rs:505 — pdfcraft_edit::isolation has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::background::page_background (cyclomatic 34) engine/crates/edit/src/background.rs:47 — pdfcraft_edit::background::page_background has cyclomatic complexity 34 (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.
  • pdfcraft_edit::added::draw_laid_shaped (cyclomatic 25) engine/crates/edit/src/added.rs:649 — pdfcraft_edit::added::draw_laid_shaped has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::images::translate_images_inlined (cyclomatic 25) engine/crates/edit/src/images.rs:766 — pdfcraft_edit::images::translate_images_inlined has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::add_header_footer (cyclomatic 23) engine/crates/edit/src/lib.rs:741 — pdfcraft_edit::add_header_footer 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.
  • pdfcraft_edit::added::shaped_layout (cyclomatic 23) engine/crates/edit/src/added.rs:447 — pdfcraft_edit::added::shaped_layout 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.
  • pdfcraft_edit::text::space_rgb (cyclomatic 23) engine/crates/edit/src/text.rs:903 — pdfcraft_edit::text::space_rgb has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_edit::text::text_lines_in (cyclomatic 23) engine/crates/edit/src/text.rs:1607 — pdfcraft_edit::text::text_lines_in 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.
  • pdfcraft_edit::text_reading::remove_all_text (cyclomatic 22) engine/crates/edit/src/text_reading.rs:428 — pdfcraft_edit::text_reading::remove_all_text has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::images::image_transform_scope (cyclomatic 21) engine/crates/edit/src/images.rs:552 — pdfcraft_edit::images::image_transform_scope 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.
  • pdfcraft_edit::objects::added_geometry (cyclomatic 20) engine/crates/edit/src/objects.rs:156 — pdfcraft_edit::objects::added_geometry has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::text::fonts_shown (cyclomatic 19) engine/crates/edit/src/text.rs:2080 — pdfcraft_edit::text::fonts_shown 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.
  • pdfcraft_edit::text::translate_blocks_inlined (cyclomatic 19) engine/crates/edit/src/text.rs:3598 — pdfcraft_edit::text::translate_blocks_inlined 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.
  • pdfcraft_edit::added::validate (cyclomatic 18) engine/crates/edit/src/added.rs:1117 — pdfcraft_edit::added::validate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::images::page_images_in (cyclomatic 18) engine/crates/edit/src/images.rs:230 — pdfcraft_edit::images::page_images_in has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_edit::added::draw (cyclomatic 17) engine/crates/edit/src/added.rs:864 — pdfcraft_edit::added::draw 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.
  • pdfcraft_edit::images::crop_image (cyclomatic 16) engine/crates/edit/src/images.rs:691 — pdfcraft_edit::images::crop_image has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · pdfcraft_redact · ×22
  • pdfcraft_redact::interp::process_from (cognitive 161) engine/crates/redact/src/interp.rs:801 — pdfcraft_redact::interp::process_from has cognitive complexity 161 (threshold 15). Drivers by points: if/else 37 (121 pts), match/switch 6 (25 pts), loops 6 (12 pts), boolean chains 3 (nesting depth added 109). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::apply_to (cognitive 144) engine/crates/redact/src/lib.rs:377 — pdfcraft_redact::apply_to has cognitive complexity 144 (threshold 15). Drivers by points: if/else 40 (104 pts), loops 14 (27 pts), match/switch 2 (7 pts), boolean chains 6 (nesting depth added 82). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_redact::sanitize::remove_hidden (cognitive 93) engine/crates/redact/src/sanitize.rs:514 — pdfcraft_redact::sanitize::remove_hidden has cognitive complexity 93 (threshold 15). Drivers by points: if/else 24 (59 pts), boolean chains 19, loops 6 (13 pts), match/switch 1 (2 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::tags::clean_within (cognitive 70) engine/crates/redact/src/tags.rs:164 — pdfcraft_redact::tags::clean_within has cognitive complexity 70 (threshold 15). Drivers by points: if/else 19 (50 pts), match/switch 4 (8 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::interp::xobject (cognitive 62) engine/crates/redact/src/interp.rs:1215 — pdfcraft_redact::interp::xobject has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (45 pts), match/switch 5 (10 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::overlay::content (cognitive 51) engine/crates/redact/src/overlay.rs:45 — pdfcraft_redact::overlay::content has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (8 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::interp::show (cognitive 44) engine/crates/redact/src/interp.rs:1142 — pdfcraft_redact::interp::show has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (7 pts), match/switch 2 (6 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::interp::unlink_doomed (cognitive 40) engine/crates/redact/src/interp.rs:479 — pdfcraft_redact::interp::unlink_doomed has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 5 (9 pts), boolean chains 5, match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::sanitize::content_pass (cognitive 40) engine/crates/redact/src/sanitize.rs:346 — pdfcraft_redact::sanitize::content_pass has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (9 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::tags::drop_object_refs_within (cognitive 37) engine/crates/redact/src/tags.rs:457 — pdfcraft_redact::tags::drop_object_refs_within has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::interp::unlink_from_forms (cognitive 33) engine/crates/redact/src/interp.rs:597 — pdfcraft_redact::interp::unlink_from_forms has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::localize_resources (cognitive 30) engine/crates/redact/src/lib.rs:295 — pdfcraft_redact::localize_resources has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 5 (12 pts), loops 3, 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.
  • pdfcraft_redact::image::decode_and_clear (cognitive 29) engine/crates/redact/src/image.rs:43 — pdfcraft_redact::image::decode_and_clear has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 3 (6 pts), boolean chains 2, match/switch 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.
  • pdfcraft_redact::patterns::phone (cognitive 26) engine/crates/redact/src/patterns.rs:138 — pdfcraft_redact::patterns::phone has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (12 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • pdfcraft_redact::interp::clean_replacements (cognitive 25) engine/crates/redact/src/interp.rs:1098 — pdfcraft_redact::interp::clean_replacements has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 4 (8 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::tags::clear_ancestors (cognitive 24) engine/crates/redact/src/tags.rs:345 — pdfcraft_redact::tags::clear_ancestors has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (9 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.
  • pdfcraft_redact::marks_checked (cognitive 23) engine/crates/redact/src/lib.rs:184 — pdfcraft_redact::marks_checked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (3 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.
  • pdfcraft_redact::interp::strip_hidden_layers (cognitive 22) engine/crates/redact/src/interp.rs:1410 — pdfcraft_redact::interp::strip_hidden_layers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::patterns::date (cognitive 19) engine/crates/redact/src/patterns.rs:356 — pdfcraft_redact::patterns::date has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::interp::content_draws (cognitive 18) engine/crates/redact/src/interp.rs:441 — pdfcraft_redact::interp::content_draws has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::patterns::credit_card (cognitive 18) engine/crates/redact/src/patterns.rs:256 — pdfcraft_redact::patterns::credit_card has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_redact::tags::by_mcid (cognitive 18) engine/crates/redact/src/tags.rs:38 — pdfcraft_redact::tags::by_mcid has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (7 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_xfa · ×22
  • pdfcraft_xfa::pdf::strip (cognitive 62) engine/crates/xfa/src/pdf.rs:1105 — pdfcraft_xfa::pdf::strip has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (45 pts), loops 7 (12 pts), boolean chains 3, match/switch 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::merge (cognitive 61) engine/crates/xfa/src/data.rs:935 — pdfcraft_xfa::data::merge has cognitive complexity 61 (threshold 15). Drivers by points: match/switch 13 (27 pts), if/else 10 (20 pts), loops 4 (8 pts), boolean chains 6 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::text::layout (cognitive 58) engine/crates/xfa/src/text.rs:248 — pdfcraft_xfa::text::layout has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 6 (12 pts), boolean chains 8, match/switch 3 (6 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::password_dataset_wants (cognitive 51) engine/crates/xfa/src/data.rs:1884 — pdfcraft_xfa::data::password_dataset_wants has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 4 (10 pts), match/switch 3 (9 pts), boolean chains 4 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::merge_values (cognitive 49) engine/crates/xfa/src/data.rs:1104 — pdfcraft_xfa::data::merge_values has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 5 (14 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::script::rerender (cognitive 41) engine/crates/xfa/src/script.rs:580 — pdfcraft_xfa::script::rerender has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 2 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_xfa::data::rewrite (cognitive 40) engine/crates/xfa/src/data.rs:1678 — pdfcraft_xfa::data::rewrite has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (35 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::script::apply_overrides::walk (cognitive 35) engine/crates/xfa/src/script.rs:468 — pdfcraft_xfa::script::apply_overrides::walk has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (23 pts), match/switch 3 (8 pts), loops 2 (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.
  • pdfcraft_xfa::image::decode (cognitive 34) engine/crates/xfa/src/image.rs:131 — pdfcraft_xfa::image::decode has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 3 (5 pts), boolean chains 4, loops 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.
  • pdfcraft_xfa::parse::apply_saved_state (cognitive 31) engine/crates/xfa/src/parse.rs:780 — pdfcraft_xfa::parse::apply_saved_state has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::packets::read_packets (cognitive 30) engine/crates/xfa/src/packets.rs:101 — pdfcraft_xfa::packets::read_packets has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 1 (2 pts), match/switch 2, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::xml_nesting_depth (cognitive 28) engine/crates/xfa/src/lib.rs:40 — pdfcraft_xfa::xml_nesting_depth has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::pattern_to_iso (cognitive 27) engine/crates/xfa/src/data.rs:433 — pdfcraft_xfa::data::pattern_to_iso has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::parse::parse_rich::walk (cognitive 22) engine/crates/xfa/src/parse.rs:259 — pdfcraft_xfa::parse::parse_rich::walk has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::parse::parse_value (cognitive 22) engine/crates/xfa/src/parse.rs:371 — pdfcraft_xfa::parse::parse_value has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::acro_password_fields (cognitive 21) engine/crates/xfa/src/data.rs:1820 — pdfcraft_xfa::data::acro_password_fields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::layout::divide (cognitive 20) engine/crates/xfa/src/layout.rs:418 — pdfcraft_xfa::layout::divide has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::pdf::signed_fields (cognitive 18) engine/crates/xfa/src/pdf.rs:285 — pdfcraft_xfa::pdf::signed_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 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.
  • pdfcraft_xfa::pdf::jpeg_info (cognitive 17) engine/crates/xfa/src/pdf.rs:58 — pdfcraft_xfa::pdf::jpeg_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::script::refresh_value::walk (cognitive 17) engine/crates/xfa/src/script.rs:673 — pdfcraft_xfa::script::refresh_value::walk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfa::data::wanted (cognitive 16) engine/crates/xfa/src/data.rs:626 — pdfcraft_xfa::data::wanted has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (6 pts), loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_xfa::text::words (cognitive 16) engine/crates/xfa/src/text.rs:204 — pdfcraft_xfa::text::words has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · pdfcraft_create · ×21
  • pdfcraft_create::office::xlsx::draw_sheet (cyclomatic 116) engine/crates/create/src/office/xlsx.rs:918 — pdfcraft_create::office::xlsx::draw_sheet has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::rtf::control (cyclomatic 106) engine/crates/create/src/office/rtf.rs:572 — pdfcraft_create::office::rtf::control has cyclomatic complexity 106 (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.
  • pdfcraft_create::office::rtf::convert (cyclomatic 51) engine/crates/create/src/office/rtf.rs:356 — pdfcraft_create::office::rtf::convert has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::extract::image (cyclomatic 41) engine/crates/create/src/extract.rs:106 — pdfcraft_create::extract::image has cyclomatic complexity 41 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_create::office::flow::render_line (cyclomatic 40) engine/crates/create/src/office/flow.rs:541 — pdfcraft_create::office::flow::render_line has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::xlsx::format_date (cyclomatic 38) engine/crates/create/src/office/xlsx.rs:537 — pdfcraft_create::office::xlsx::format_date has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::flow::layout_para (cyclomatic 37) engine/crates/create/src/office/flow.rs:367 — pdfcraft_create::office::flow::layout_para has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::docx::parse_ppr (cyclomatic 36) engine/crates/create/src/office/docx.rs:176 — pdfcraft_create::office::docx::parse_ppr has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::flow::paginate (cyclomatic 32) engine/crates/create/src/office/flow.rs:906 — pdfcraft_create::office::flow::paginate has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::xlsx::parse_sheet (cyclomatic 32) engine/crates/create/src/office/xlsx.rs:762 — pdfcraft_create::office::xlsx::parse_sheet has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_create::office::xlsx::builtin_format (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_create::jpeg (cyclomatic 28) engine/crates/create/src/lib.rs:230 — pdfcraft_create::jpeg has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::docx::convert (cyclomatic 27) engine/crates/create/src/office/docx.rs:670 — pdfcraft_create::office::docx::convert has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_create::office::xlsx::format_value (cyclomatic 27) engine/crates/create/src/office/xlsx.rs:356 — pdfcraft_create::office::xlsx::format_value has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_create::office::xlsx::builtin_format (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_create::office::xlsx::format_number (cyclomatic 26) engine/crates/create/src/office/xlsx.rs:461 — pdfcraft_create::office::xlsx::format_number has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: pdfcraft_create::office::xlsx::builtin_format (cyclomatic 33) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_create::extract::space (cyclomatic 22) engine/crates/create/src/extract.rs:365 — pdfcraft_create::extract::space 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.
  • pdfcraft_create::office::flow::layout_table (cyclomatic 22) engine/crates/create/src/office/flow.rs:764 — pdfcraft_create::office::flow::layout_table has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_create::office::pptx::preset (cyclomatic 21) engine/crates/create/src/office/pptx.rs:436 — pdfcraft_create::office::pptx::preset has cyclomatic complexity 21 (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.
  • pdfcraft_create::office::docx::parse_rpr (cyclomatic 20) engine/crates/create/src/office/docx.rs:124 — pdfcraft_create::office::docx::parse_rpr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_create::office::pptx::render_slide (cyclomatic 19) engine/crates/create/src/office/pptx.rs:717 — pdfcraft_create::office::pptx::render_slide has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_create::office::xml::nests_deeper_than (cyclomatic 19) engine/crates/create/src/office/xml.rs:31 — pdfcraft_create::office::xml::nests_deeper_than 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.
  • pdfcraft_create::tiff_pages_within (cyclomatic 18) engine/crates/create/src/lib.rs:432 — pdfcraft_create::tiff_pages_within has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · pdfcraft_engine · ×21
  • pdfcraft_engine::run_edit (cognitive 85) engine/crates/engine/src/lib.rs:2548 — pdfcraft_engine::run_edit has cognitive complexity 85 (threshold 15). Drivers by points: if/else 23 (47 pts), match/switch 16 (32 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 41). 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.
  • pdfcraft_engine::camera_edges::hough (cognitive 54) engine/crates/engine/src/camera_edges.rs:162 — pdfcraft_engine::camera_edges::hough has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 6 (13 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::camera_clean::background (cognitive 52) engine/crates/engine/src/camera_clean.rs:145 — pdfcraft_engine::camera_clean::background has cognitive complexity 52 (threshold 15). Drivers by points: loops 13 (40 pts), if/else 2 (12 pts) (nesting depth added 37). 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.
  • pdfcraft_engine::word_count::exclusions (cognitive 31) engine/crates/engine/src/word_count.rs:129 — pdfcraft_engine::word_count::exclusions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 4, loops 2, 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.
  • pdfcraft_engine::camera_edges::best_quad (cognitive 30) engine/crates/engine/src/camera_edges.rs:384 — pdfcraft_engine::camera_edges::best_quad has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (20 pts), loops 4 (10 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.
  • pdfcraft_engine::signature_scan::box_blur (cognitive 29) engine/crates/engine/src/signature_scan.rs:279 — pdfcraft_engine::signature_scan::box_blur has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 7 (9 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::camera_edges::refine (cognitive 28) engine/crates/engine/src/camera_edges.rs:286 — pdfcraft_engine::camera_edges::refine has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::printcheck::image_reports (cognitive 28) engine/crates/engine/src/printcheck.rs:274 — pdfcraft_engine::printcheck::image_reports has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 3 (6 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::text_fonts::discover (cognitive 27) engine/crates/engine/src/text_fonts.rs:37 — pdfcraft_engine::text_fonts::discover has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 5, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::camera::warp (cognitive 24) engine/crates/engine/src/camera.rs:32 — pdfcraft_engine::camera::warp has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 4 (9 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • pdfcraft_engine::signature_scan::label_components (cognitive 21) engine/crates/engine/src/signature_scan.rs:410 — pdfcraft_engine::signature_scan::label_components has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (9 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.
  • pdfcraft_engine::comment_summary (cognitive 20) engine/crates/engine/src/lib.rs:5563 — pdfcraft_engine::comment_summary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::scan_colours::sample (cognitive 20) engine/crates/engine/src/scan_colours.rs:19 — pdfcraft_engine::scan_colours::sample has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_engine::signature_scan::extract_ink (cognitive 20) engine/crates/engine/src/signature_scan.rs:444 — pdfcraft_engine::signature_scan::extract_ink has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::undrawn_notices (cognitive 19) engine/crates/engine/src/lib.rs:487 — pdfcraft_engine::undrawn_notices has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::shown_under_redactions (cognitive 19) engine/crates/engine/src/lib.rs:1040 — pdfcraft_engine::shown_under_redactions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::check_permission (cognitive 19) engine/crates/engine/src/lib.rs:2317 — pdfcraft_engine::check_permission has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_engine::camera_edges::shrink (cognitive 19) engine/crates/engine/src/camera_edges.rs:71 — pdfcraft_engine::camera_edges::shrink has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (9 pts) (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.
  • pdfcraft_engine::xfa_after_data_change (cognitive 18) engine/crates/engine/src/lib.rs:3489 — pdfcraft_engine::xfa_after_data_change has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::copy_image::collect (cognitive 18) engine/crates/engine/src/copy_image.rs:131 — pdfcraft_engine::copy_image::collect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_engine::dates::format_day (cognitive 18) engine/crates/engine/src/dates.rs:640 — pdfcraft_engine::dates::format_day has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · pdfcraft_forms · ×20
  • pdfcraft_forms::author::set_props (cyclomatic 103) engine/crates/forms/src/author.rs:1160 — pdfcraft_forms::author::set_props has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_forms::af::parse_date (cyclomatic 49) engine/crates/forms/src/af.rs:982 — pdfcraft_forms::af::parse_date has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_forms::write_value (cyclomatic 47) engine/crates/forms/src/lib.rs:1048 — pdfcraft_forms::write_value has cyclomatic complexity 47 (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.
  • pdfcraft_forms::appearance::field_appearance_fit (cyclomatic 38) engine/crates/forms/src/appearance.rs:738 — pdfcraft_forms::appearance::field_appearance_fit has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_forms::detect::page_shapes (cyclomatic 36) engine/crates/forms/src/detect.rs:128 — pdfcraft_forms::detect::page_shapes has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_forms::af::js_tokens (cyclomatic 34) engine/crates/forms/src/af.rs:504 — pdfcraft_forms::af::js_tokens has cyclomatic complexity 34 (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.
  • pdfcraft_forms::af::format_date (cyclomatic 28) engine/crates/forms/src/af.rs:1117 — pdfcraft_forms::af::format_date has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_forms::walk (cyclomatic 26) engine/crates/forms/src/lib.rs:782 — pdfcraft_forms::walk has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_forms::author::add_field (cyclomatic 25) engine/crates/forms/src/author.rs:817 — pdfcraft_forms::author::add_field has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_forms::detect::detect (cyclomatic 23) engine/crates/forms/src/detect.rs:354 — pdfcraft_forms::detect::detect 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.
  • pdfcraft_forms::button_action (cyclomatic 21) engine/crates/forms/src/lib.rs:271 — pdfcraft_forms::button_action has cyclomatic complexity 21 (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.
  • pdfcraft_forms::af::order (cyclomatic 21) engine/crates/forms/src/af.rs:916 — pdfcraft_forms::af::order 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.
  • pdfcraft_forms::scripting::apply_changes (cyclomatic 20) engine/crates/forms/src/scripting.rs:104 — pdfcraft_forms::scripting::apply_changes 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.
  • pdfcraft_forms::af::calculation_sites (cyclomatic 19) engine/crates/forms/src/af.rs:706 — pdfcraft_forms::af::calculation_sites 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.
  • pdfcraft_forms::detect::raster::writing_area (cyclomatic 19) engine/crates/forms/src/detect/raster.rs:300 — pdfcraft_forms::detect::raster::writing_area 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.
  • pdfcraft_forms::with_field_appearances_cached (cyclomatic 18) engine/crates/forms/src/lib.rs:1476 — pdfcraft_forms::with_field_appearances_cached has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_forms::detect::raster::enclosed (cyclomatic 18) engine/crates/forms/src/detect/raster.rs:227 — pdfcraft_forms::detect::raster::enclosed has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_forms::rank_tabs (cyclomatic 17) engine/crates/forms/src/lib.rs:696 — pdfcraft_forms::rank_tabs 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.
  • pdfcraft_forms::actions_of (cyclomatic 16) engine/crates/forms/src/lib.rs:401 — pdfcraft_forms::actions_of has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_forms::author::patch_widget_look (cyclomatic 16) engine/crates/forms/src/author.rs:336 — pdfcraft_forms::author::patch_widget_look 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 · pdfcraft_sign · ×20
  • pdfcraft_sign::pdf::appearance (cognitive 75) engine/crates/sign/src/pdf.rs:2341 — pdfcraft_sign::pdf::appearance has cognitive complexity 75 (threshold 15). Drivers by points: if/else 33 (50 pts), loops 5 (13 pts), boolean chains 10, match/switch 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::classify_changes (cognitive 68) engine/crates/sign/src/pdf.rs:1335 — pdfcraft_sign::pdf::classify_changes has cognitive complexity 68 (threshold 15). Drivers by points: if/else 29 (46 pts), match/switch 6 (10 pts), boolean chains 9, loops 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::validate_into (cognitive 37) engine/crates/sign/src/pdf.rs:719 — pdfcraft_sign::pdf::validate_into has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (25 pts), match/switch 5 (7 pts), boolean chains 5 (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.
  • pdfcraft_sign::pdf::finish_validation (cognitive 35) engine/crates/sign/src/pdf.rs:882 — pdfcraft_sign::pdf::finish_validation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 10, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::sign_inner (cognitive 31) engine/crates/sign/src/pdf.rs:2049 — pdfcraft_sign::pdf::sign_inner has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 6 (10 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::change_kind (cognitive 29) engine/crates/sign/src/pdf.rs:1835 — pdfcraft_sign::pdf::change_kind has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, match/switch 4 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::cms::parse_signer (cognitive 26) engine/crates/sign/src/cms.rs:240 — pdfcraft_sign::cms::parse_signer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (6 pts), boolean chains 2, loops 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.
  • pdfcraft_sign::pdf::validate_doc_timestamp (cognitive 26) engine/crates/sign/src/pdf.rs:1146 — pdfcraft_sign::pdf::validate_doc_timestamp has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_sign::pdf::signed_page_resources (cognitive 26) engine/crates/sign/src/pdf.rs:1734 — pdfcraft_sign::pdf::signed_page_resources has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), match/switch 3 (4 pts), boolean chains 3 (nesting depth added 10). Of this number, 15 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pkcs12::bags (cognitive 25) engine/crates/sign/src/pkcs12.rs:304 — pdfcraft_sign::pkcs12::bags has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::dss_walk (cognitive 22) engine/crates/sign/src/pdf.rs:1560 — pdfcraft_sign::pdf::dss_walk has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (10 pts), loops 3 (7 pts), if/else 3 (5 pts) (nesting depth added 13). 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.
  • pdfcraft_sign::x509::build_chain_noted (cognitive 21) engine/crates/sign/src/x509.rs:525 — pdfcraft_sign::x509::build_chain_noted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::sig_fields (cognitive 19) engine/crates/sign/src/pdf.rs:514 — pdfcraft_sign::pdf::sig_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pkcs12::open (cognitive 19) engine/crates/sign/src/pkcs12.rs:385 — pdfcraft_sign::pkcs12::open has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (8 pts), if/else 4 (5 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::check_dss_revocation (cognitive 18) engine/crates/sign/src/pdf.rs:1076 — pdfcraft_sign::pdf::check_dss_revocation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (6 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::x509::load_certificates (cognitive 18) engine/crates/sign/src/x509.rs:570 — pdfcraft_sign::x509::load_certificates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pdf::signature_contents (cognitive 17) engine/crates/sign/src/pdf.rs:1236 — pdfcraft_sign::pdf::signature_contents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::pkcs12::pbe_decrypt (cognitive 17) engine/crates/sign/src/pkcs12.rs:222 — pdfcraft_sign::pkcs12::pbe_decrypt has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 3 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_sign::pdf::list_cached (cognitive 16) engine/crates/sign/src/pdf.rs:579 — pdfcraft_sign::pdf::list_cached has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_sign::windows::entries (cognitive 16) engine/crates/sign/src/windows.rs:114 — pdfcraft_sign::windows::entries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 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.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×19
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/xfa/src/data.rs:46 — `count` is public and takes a `DataNode` as its receiver from its caller, and it calls itself at line 46 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `count` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:275 — `apply` is public, takes a document from its caller (line 3960) and hands it to `uses_scripts`, which calls itself at line 275 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `uses_scripts` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:324 — `apply` is public, takes a document from its caller (line 3960) and hands it to `scope_of`, which calls itself at line 324 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `scope_of` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:714 — `permissions` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 714 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `permissions` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:585 — `text_blocks` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 585 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `text_blocks` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:924 — `revision_ends` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 924 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `revision_ends` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:935 — `repair_log` is public and takes a `Document` as its receiver from its caller, and it calls itself at line 935 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `repair_log` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:2221 — `label` is public and takes a `Edit` as its receiver from its caller, and it calls itself at line 2221 with a piece of the document (and at line 2222) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `label` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:2449 — `apply` is public, takes a document from its caller (line 3960) and hands it to `check_permission`, which calls itself at line 2449 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `check_permission` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:3003 — `apply` is public, takes a document from its caller (line 3960) and hands it to `run_edit`, which calls itself at line 3003 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `run_edit` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/engine/src/lib.rs:3064 — `apply` is public, takes a document from its caller (line 3960) and hands it to `keys_after`, which calls itself at line 3064 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `keys_after` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:172 — `iter` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 172 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `iter` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:131 — `get` is public and takes a `Dict` as its receiver from its caller, and it recurses at line 131 through `position` and back with a piece of the document (and at line 121, line 123) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `get` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:136 — `get_mut` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 136 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `get_mut` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:176 — `len` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 176 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `len` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:161 — `remove` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 161 with a piece of the document (and at line 164) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `remove` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/object.rs:180 — `is_empty` is public and takes a `Dict` as its receiver from its caller, and it calls itself at line 180 with a piece of the document — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `is_empty` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/security.rs:168 — `transform` is public, takes a document from its caller (line 155) and hands it to `walk`, which calls itself at line 168 with a piece of the document (and at line 173, line 177, line 179) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `walk` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap engine/crates/cos/src/writer.rs:38 — `serialize` is public and takes `o: &Object` from its caller, and it recurses at line 38 through `write_stream`, `write_dict` and back with a piece of the document (and at line 42, line 43, line 120, line 128) — and nowhere in the walk is a depth or nesting counter compared with a bound. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. When a Rust thread runs out of stack it is not unwound: the runtime reports the overflow and aborts the process, so `catch_unwind` does not stop it and every other request the process serves dies with it (spawned threads, a Tokio worker included, get 2 MiB by default). serde_json and serde_yaml stop parsing at 128 levels only on their default path; a value from `disable_recursion_limit`, from another format or parser, or built in code carries whatever nesting it was given. Thread a depth argument through `serialize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D2 · Cognitive Complexity · pdfcraft_organize · ×18
  • pdfcraft_organize::import::import_pages_mapped (cognitive 67) engine/crates/organize/src/import.rs:377 — pdfcraft_organize::import::import_pages_mapped has cognitive complexity 67 (threshold 15). Drivers by points: if/else 14 (44 pts), loops 4 (9 pts), boolean chains 7, match/switch 3 (7 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::labels::read_label_node (cognitive 37) engine/crates/organize/src/labels.rs:142 — pdfcraft_organize::labels::read_label_node has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 2 (7 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::dedupe::collect_resource_refs (cognitive 29) engine/crates/organize/src/dedupe.rs:50 — pdfcraft_organize::dedupe::collect_resource_refs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_organize::dedupe::dedupe_resources (cognitive 27) engine/crates/organize/src/dedupe.rs:193 — pdfcraft_organize::dedupe::dedupe_resources has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (8 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::prune::filter_at (cognitive 27) engine/crates/organize/src/prune.rs:265 — pdfcraft_organize::prune::filter_at has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_organize::import::resources_with_ancestors (cognitive 26) engine/crates/organize/src/import.rs:533 — pdfcraft_organize::import::resources_with_ancestors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (7 pts), match/switch 1 (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.
  • pdfcraft_organize::outline::name_tree (cognitive 26) engine/crates/organize/src/outline.rs:189 — pdfcraft_organize::outline::name_tree has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::boxes::set_page_box (cognitive 23) engine/crates/organize/src/boxes.rs:81 — pdfcraft_organize::boxes::set_page_box has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, match/switch 2 (4 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::import::field_roots (cognitive 22) engine/crates/organize/src/import.rs:806 — pdfcraft_organize::import::field_roots has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::view::set_initial_view (cognitive 22) engine/crates/organize/src/view.rs:167 — pdfcraft_organize::view::set_initial_view has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 8 (9 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_organize::prune_tree_node (cognitive 20) engine/crates/organize/src/lib.rs:445 — pdfcraft_organize::prune_tree_node has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::drop_widgets (cognitive 20) engine/crates/organize/src/lib.rs:480 — pdfcraft_organize::drop_widgets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::import::field_and_widget (cognitive 20) engine/crates/organize/src/import.rs:915 — pdfcraft_organize::import::field_and_widget has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::view::initial_view (cognitive 19) engine/crates/organize/src/view.rs:78 — pdfcraft_organize::view::initial_view has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 7). 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.
  • pdfcraft_organize::drop_destinations_to (cognitive 18) engine/crates/organize/src/lib.rs:297 — pdfcraft_organize::drop_destinations_to has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3, match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::transition::set_transition (cognitive 18) engine/crates/organize/src/transition.rs:54 — pdfcraft_organize::transition::set_transition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • pdfcraft_organize::import::combine_grouped_with (cognitive 17) engine/crates/organize/src/import.rs:1210 — pdfcraft_organize::import::combine_grouped_with has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (6 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_organize::outline::recount (cognitive 17) engine/crates/organize/src/outline.rs:467 — pdfcraft_organize::outline::recount has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, 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.
D1 · Cyclomatic Complexity · pdfcraft_xfa · ×17
  • pdfcraft_xfa::data::merge (cyclomatic 40) engine/crates/xfa/src/data.rs:935 — pdfcraft_xfa::data::merge has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_xfa::pdf::strip (cyclomatic 34) engine/crates/xfa/src/pdf.rs:1105 — pdfcraft_xfa::pdf::strip has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfa::text::layout (cyclomatic 30) engine/crates/xfa/src/text.rs:248 — pdfcraft_xfa::text::layout has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfa::data::password_dataset_wants (cyclomatic 26) engine/crates/xfa/src/data.rs:1884 — pdfcraft_xfa::data::password_dataset_wants has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfa::image::decode (cyclomatic 23) engine/crates/xfa/src/image.rs:131 — pdfcraft_xfa::image::decode 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.
  • pdfcraft_xfa::data::rewrite (cyclomatic 22) engine/crates/xfa/src/data.rs:1678 — pdfcraft_xfa::data::rewrite has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfa::data::merge_values (cyclomatic 21) engine/crates/xfa/src/data.rs:1104 — pdfcraft_xfa::data::merge_values 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.
  • pdfcraft_xfa::parse::parse_field (cyclomatic 21) engine/crates/xfa/src/parse.rs:474 — pdfcraft_xfa::parse::parse_field has cyclomatic complexity 21 (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.
  • pdfcraft_xfa::script::apply_overrides::walk (cyclomatic 20) engine/crates/xfa/src/script.rs:468 — pdfcraft_xfa::script::apply_overrides::walk has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfa::packets::read_packets (cyclomatic 19) engine/crates/xfa/src/packets.rs:101 — pdfcraft_xfa::packets::read_packets 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.
  • pdfcraft_xfa::data::pattern_to_iso (cyclomatic 17) engine/crates/xfa/src/data.rs:433 — pdfcraft_xfa::data::pattern_to_iso 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.
  • pdfcraft_xfa::parse::apply_saved_state (cyclomatic 17) engine/crates/xfa/src/parse.rs:780 — pdfcraft_xfa::parse::apply_saved_state 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.
  • pdfcraft_xfa::xml_nesting_depth (cyclomatic 16) engine/crates/xfa/src/lib.rs:40 — pdfcraft_xfa::xml_nesting_depth 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.
  • pdfcraft_xfa::data::iso_to_pattern (cyclomatic 16) engine/crates/xfa/src/data.rs:398 — pdfcraft_xfa::data::iso_to_pattern has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_xfa::parse::parse_rich::walk (cyclomatic 16) engine/crates/xfa/src/parse.rs:259 — pdfcraft_xfa::parse::parse_rich::walk 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.
  • pdfcraft_xfa::script::rerender (cyclomatic 16) engine/crates/xfa/src/script.rs:580 — pdfcraft_xfa::script::rerender 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.
  • pdfcraft_xfa::script::refresh_value (cyclomatic 16) engine/crates/xfa/src/script.rs:665 — pdfcraft_xfa::script::refresh_value has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (walk). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · Automation · ×16
  • Automation::call (cognitive 110) engine/crates/automation/src/lib.rs:204 — Automation::call has cognitive complexity 110 (threshold 15). Drivers by points: if/else 31 (58 pts), match/switch 20 (42 pts), boolean chains 10 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::comment_add (cognitive 53) engine/crates/automation/src/comments.rs:247 — Automation::comment_add has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 11 (23 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::redact_mark (cognitive 52) engine/crates/automation/src/redact.rs:14 — Automation::redact_mark has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (28 pts), match/switch 7 (13 pts), loops 3 (7 pts), boolean chains 4 (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.
  • Automation::fill_sign_add (cognitive 28) engine/crates/automation/src/comments.rs:496 — Automation::fill_sign_add has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::form_set_props (cognitive 28) engine/crates/automation/src/forms.rs:420 — Automation::form_set_props has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::doc_combine (cognitive 27) engine/crates/automation/src/lib.rs:1872 — Automation::doc_combine has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 8 (12 pts), if/else 4 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::content_update (cognitive 26) engine/crates/automation/src/content.rs:154 — Automation::content_update has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), match/switch 2 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Automation::text_find_with (cognitive 24) engine/crates/automation/src/lib.rs:2232 — Automation::text_find_with has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::doc_batch (cognitive 23) engine/crates/automation/src/batch.rs:178 — Automation::doc_batch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 3, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::doc_split (cognitive 22) engine/crates/automation/src/lib.rs:1966 — Automation::doc_split has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Automation::page_transition_set (cognitive 20) engine/crates/automation/src/lib.rs:1610 — Automation::page_transition_set has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 5 (10 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Automation::doc_print (cognitive 20) engine/crates/automation/src/printing.rs:119 — Automation::doc_print has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 8 (11 pts), if/else 6 (8 pts), boolean chains 1 (nesting depth added 5). 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.
  • Automation::comment_edit (cognitive 19) engine/crates/automation/src/comments.rs:642 — Automation::comment_edit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
  • Automation::doc_initial_view (cognitive 19) engine/crates/automation/src/lib.rs:1166 — Automation::doc_initial_view has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 5 (9 pts), loops 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Automation::doc_create (cognitive 17) engine/crates/automation/src/lib.rs:1542 — Automation::doc_create has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 3 (5 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Automation::marks (cognitive 16) engine/crates/automation/src/lib.rs:1401 — Automation::marks has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (8 pts), if/else 3 (6 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×14
  • Edited copy of a member (3 corresponding lines) engine/crates/a11y/src/content.rs:169 — engine/crates/a11y/src/content.rs:169-171 | engine/crates/a11y/src/structure.rs:409-411 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/create/src/lib.rs:156 — engine/crates/create/src/lib.rs:156-158 | engine/mobile/src/ppt.rs:116-118 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/create/src/office/docx.rs:817 — engine/crates/create/src/office/docx.rs:817-819 | engine/crates/create/src/office/pptx.rs:611-613 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/automation/src/a11y.rs:674 — engine/crates/automation/src/a11y.rs:674-676 | engine/mobile/src/office.rs:228-230 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/edit/src/text_reading.rs:293 — engine/crates/edit/src/text_reading.rs:293-295 | engine/crates/export/src/lib.rs:519-522 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/engine/src/ocr.rs:75 — engine/crates/engine/src/ocr.rs:75-77 | engine/crates/ocr/src/lib.rs:104-106 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/forms/src/appearance.rs:491 — engine/crates/forms/src/appearance.rs:491-493 | engine/crates/forms/src/lib.rs:1458-1460 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/organize/src/pdfx.rs:189 — engine/crates/organize/src/pdfx.rs:189-191 | engine/crates/preflight/src/xmp.rs:143-145 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/a11y/src/content.rs:143 — engine/crates/a11y/src/content.rs:143-145 | engine/crates/preflight/src/lib.rs:159-161 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/create/src/office/xml.rs:106 — engine/crates/create/src/office/xml.rs:106-108 | engine/crates/xfa/src/parse.rs:65-67 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/create/src/office/xml.rs:101 — engine/crates/create/src/office/xml.rs:101-103 | engine/crates/xfa/src/parse.rs:61-63 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/annot/src/appearance.rs:230 — engine/crates/annot/src/appearance.rs:230-232 | engine/crates/xfa/src/pdf.rs:104-106 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) engine/crates/annot/src/lib.rs:854 — engine/crates/annot/src/lib.rs:854-856 | engine/crates/organize/src/lib.rs:163-165 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:154 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:154-156 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt:528-530 — 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.
D1 · Cyclomatic Complexity · pdfcraft_redact · ×13
  • pdfcraft_redact::interp::process_from (cyclomatic 70) engine/crates/redact/src/interp.rs:801 — pdfcraft_redact::interp::process_from has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::apply_to (cyclomatic 59) engine/crates/redact/src/lib.rs:377 — pdfcraft_redact::apply_to has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::sanitize::remove_hidden (cyclomatic 53) engine/crates/redact/src/sanitize.rs:514 — pdfcraft_redact::sanitize::remove_hidden has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::tags::clean_within (cyclomatic 36) engine/crates/redact/src/tags.rs:164 — pdfcraft_redact::tags::clean_within has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::interp::xobject (cyclomatic 35) engine/crates/redact/src/interp.rs:1215 — pdfcraft_redact::interp::xobject has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::overlay::content (cyclomatic 26) engine/crates/redact/src/overlay.rs:45 — pdfcraft_redact::overlay::content has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::interp::unlink_doomed (cyclomatic 25) engine/crates/redact/src/interp.rs:479 — pdfcraft_redact::interp::unlink_doomed has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::patterns::phone (cyclomatic 23) engine/crates/redact/src/patterns.rs:138 — pdfcraft_redact::patterns::phone has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • pdfcraft_redact::tags::drop_object_refs_within (cyclomatic 22) engine/crates/redact/src/tags.rs:457 — pdfcraft_redact::tags::drop_object_refs_within has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::image::decode_and_clear (cyclomatic 20) engine/crates/redact/src/image.rs:43 — pdfcraft_redact::image::decode_and_clear has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::sanitize::content_pass (cyclomatic 20) engine/crates/redact/src/sanitize.rs:346 — pdfcraft_redact::sanitize::content_pass has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_redact::interp::show (cyclomatic 17) engine/crates/redact/src/interp.rs:1142 — pdfcraft_redact::interp::show 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.
  • pdfcraft_redact::localize_resources (cyclomatic 16) engine/crates/redact/src/lib.rs:295 — pdfcraft_redact::localize_resources 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 · pdfcraft_annot · ×13
  • pdfcraft_annot::appearance::build (cognitive 235) engine/crates/annot/src/appearance.rs:382 — pdfcraft_annot::appearance::build has cognitive complexity 235 (threshold 15). Drivers by points: if/else 74 (162 pts), loops 11 (29 pts), boolean chains 22, match/switch 10 (22 pts) (nesting depth added 118). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_annot::add_annotation (cognitive 67) engine/crates/annot/src/lib.rs:1152 — pdfcraft_annot::add_annotation has cognitive complexity 67 (threshold 15). Drivers by points: if/else 30 (57 pts), boolean chains 8, match/switch 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_annot::rect_for (cognitive 37) engine/crates/annot/src/lib.rs:991 — pdfcraft_annot::rect_for has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 11, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_annot::summaries (cognitive 36) engine/crates/annot/src/lib.rs:2380 — pdfcraft_annot::summaries has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (6 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_annot::erase_ink (cognitive 28) engine/crates/annot/src/lib.rs:2653 — pdfcraft_annot::erase_ink has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_annot::set_style (cognitive 27) engine/crates/annot/src/lib.rs:2127 — pdfcraft_annot::set_style has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 6 (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.
  • pdfcraft_annot::links::find_urls (cognitive 26) engine/crates/annot/src/links.rs:403 — pdfcraft_annot::links::find_urls has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 7, loops 3 (7 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.
  • pdfcraft_annot::links::email_at (cognitive 24) engine/crates/annot/src/links.rs:350 — pdfcraft_annot::links::email_at has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, loops 4 (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.
  • pdfcraft_annot::appearance::line_end (cognitive 21) engine/crates/annot/src/appearance.rs:46 — pdfcraft_annot::appearance::line_end has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_annot::appearance::line_layout (cognitive 21) engine/crates/annot/src/appearance.rs:1142 — pdfcraft_annot::appearance::line_layout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_annot::with_missing_appearances_cached (cognitive 18) engine/crates/annot/src/lib.rs:1609 — pdfcraft_annot::with_missing_appearances_cached has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_annot::appearance::rich_plain (cognitive 18) engine/crates/annot/src/appearance.rs:1049 — pdfcraft_annot::appearance::rich_plain has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 2 (6 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_annot::links::list (cognitive 17) engine/crates/annot/src/links.rs:148 — pdfcraft_annot::links::list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D1 · Cyclomatic Complexity · Automation · ×12
  • Automation::call (cyclomatic 256) engine/crates/automation/src/lib.rs:204 — Automation::call has cyclomatic complexity 256 (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.
  • Automation::comment_add (cyclomatic 45) engine/crates/automation/src/comments.rs:247 — Automation::comment_add has cyclomatic complexity 45 (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.
  • Automation::doc_print (cyclomatic 34) engine/crates/automation/src/printing.rs:119 — Automation::doc_print has cyclomatic complexity 34 (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.
  • Automation::redact_mark (cyclomatic 34) engine/crates/automation/src/redact.rs:14 — Automation::redact_mark has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Automation::doc_initial_view (cyclomatic 32) engine/crates/automation/src/lib.rs:1166 — Automation::doc_initial_view 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.
  • Automation::field_props_arg (cyclomatic 25) engine/crates/automation/src/forms.rs:488 — Automation::field_props_arg has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Automation::fill_sign_add (cyclomatic 24) engine/crates/automation/src/comments.rs:496 — Automation::fill_sign_add has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Automation::doc_combine (cyclomatic 24) engine/crates/automation/src/lib.rs:1872 — Automation::doc_combine has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Automation::sign_document (cyclomatic 21) engine/crates/automation/src/signing.rs:199 — Automation::sign_document has cyclomatic complexity 21 (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.
  • Automation::form_set_props (cyclomatic 17) engine/crates/automation/src/forms.rs:420 — Automation::form_set_props 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.
  • Automation::doc_batch (cyclomatic 16) engine/crates/automation/src/batch.rs:178 — Automation::doc_batch 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.
  • Automation::marks (cyclomatic 16) engine/crates/automation/src/lib.rs:1401 — Automation::marks has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · pdfcraft_js · ×12
  • pdfcraft_js::formcalc::lex (cyclomatic 43) engine/crates/js/src/formcalc.rs:70 — pdfcraft_js::formcalc::lex has cyclomatic complexity 43 (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.
  • pdfcraft_js::xfa::node_get (cyclomatic 32) engine/crates/js/src/xfa.rs:984 — pdfcraft_js::xfa::node_get 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.
  • pdfcraft_js::printf (cyclomatic 27) engine/crates/js/src/lib.rs:738 — pdfcraft_js::printf has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_js::printd (cyclomatic 26) engine/crates/js/src/lib.rs:868 — pdfcraft_js::printd has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_js::scan_date (cyclomatic 26) engine/crates/js/src/lib.rs:1145 — pdfcraft_js::scan_date has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_js::xfa::resolve_som (cyclomatic 23) engine/crates/js/src/xfa.rs:872 — pdfcraft_js::xfa::resolve_som 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.
  • pdfcraft_js::refuse (cyclomatic 21) engine/crates/js/src/lib.rs:1521 — pdfcraft_js::refuse has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_js::scan_parts (cyclomatic 20) engine/crates/js/src/lib.rs:1002 — pdfcraft_js::scan_parts has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_js::printx (cyclomatic 20) engine/crates/js/src/lib.rs:1275 — pdfcraft_js::printx 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.
  • pdfcraft_js::formcalc::parse_date (cyclomatic 20) engine/crates/js/src/formcalc.rs:1897 — pdfcraft_js::formcalc::parse_date has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_js::formcalc::format_date (cyclomatic 18) engine/crates/js/src/formcalc.rs:1967 — pdfcraft_js::formcalc::format_date 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.
  • pdfcraft_js::formcalc::parse_num (cyclomatic 16) engine/crates/js/src/formcalc.rs:725 — pdfcraft_js::formcalc::parse_num 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 · pdfcraft_a11y · ×12
  • pdfcraft_a11y::content::page_rule (cognitive 87) engine/crates/a11y/src/content.rs:262 — pdfcraft_a11y::content::page_rule has cognitive complexity 87 (threshold 15). Drivers by points: if/else 17 (53 pts), loops 8 (19 pts), match/switch 3 (10 pts), boolean chains 5 (nesting depth added 54). 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.
  • pdfcraft_a11y::headings::mcid_texts (cognitive 64) engine/crates/a11y/src/headings.rs:181 — pdfcraft_a11y::headings::mcid_texts has cognitive complexity 64 (threshold 15). Drivers by points: if/else 14 (44 pts), match/switch 4 (10 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::autotag_fields::tag_form_fields (cognitive 33) engine/crates/a11y/src/autotag_fields.rs:30 — pdfcraft_a11y::autotag_fields::tag_form_fields has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::check (cognitive 30) engine/crates/a11y/src/lib.rs:632 — pdfcraft_a11y::check has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 3 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::alt::content_bboxes (cognitive 28) engine/crates/a11y/src/alt.rs:235 — pdfcraft_a11y::alt::content_bboxes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::alt::clear_parent_tree (cognitive 23) engine/crates/a11y/src/alt.rs:571 — pdfcraft_a11y::alt::clear_parent_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::alt::elements (cognitive 22) engine/crates/a11y/src/alt.rs:89 — pdfcraft_a11y::alt::elements has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::content::document_rule (cognitive 22) engine/crates/a11y/src/content.rs:177 — pdfcraft_a11y::content::document_rule has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_a11y::tags::set_tag_property (cognitive 19) engine/crates/a11y/src/tags.rs:317 — pdfcraft_a11y::tags::set_tag_property has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, match/switch 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.
  • pdfcraft_a11y::alt::artifact_marked_content (cognitive 18) engine/crates/a11y/src/alt.rs:381 — pdfcraft_a11y::alt::artifact_marked_content has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 3 (7 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_a11y::alt::mark_tag_artifact (cognitive 16) engine/crates/a11y/src/alt.rs:480 — pdfcraft_a11y::alt::mark_tag_artifact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_a11y::autotag::text_spans (cognitive 16) engine/crates/a11y/src/autotag.rs:136 — pdfcraft_a11y::autotag::text_spans has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_js · ×12
  • pdfcraft_js::formcalc::lex (cognitive 69) engine/crates/js/src/formcalc.rs:70 — pdfcraft_js::formcalc::lex has cognitive complexity 69 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 7 (21 pts), boolean chains 16, match/switch 3 (9 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::xfa::resolve_som (cognitive 52) engine/crates/js/src/xfa.rs:872 — pdfcraft_js::xfa::resolve_som has cognitive complexity 52 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 4 (9 pts), match/switch 3 (9 pts), boolean chains 5 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::printf (cognitive 49) engine/crates/js/src/lib.rs:738 — pdfcraft_js::printf has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (8 pts), match/switch 3 (8 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::formcalc::parse_date (cognitive 48) engine/crates/js/src/formcalc.rs:1897 — pdfcraft_js::formcalc::parse_date has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 3 (7 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::printd (cognitive 37) engine/crates/js/src/lib.rs:868 — pdfcraft_js::printd has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (26 pts), match/switch 4 (10 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::scan_date (cognitive 32) engine/crates/js/src/lib.rs:1145 — pdfcraft_js::scan_date has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (8 pts), match/switch 3 (6 pts), boolean chains 5 (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.
  • pdfcraft_js::refuse (cognitive 29) engine/crates/js/src/lib.rs:1521 — pdfcraft_js::refuse has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (10 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::printx (cognitive 24) engine/crates/js/src/lib.rs:1275 — pdfcraft_js::printx has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::scan_parts (cognitive 20) engine/crates/js/src/lib.rs:1002 — pdfcraft_js::scan_parts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::formcalc::format_date (cognitive 20) engine/crates/js/src/formcalc.rs:1967 — pdfcraft_js::formcalc::format_date has cognitive complexity 20 (threshold 15). Drivers by points: loops 3 (7 pts), match/switch 2 (6 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_js::formcalc::parse_num (cognitive 19) engine/crates/js/src/formcalc.rs:725 — pdfcraft_js::formcalc::parse_num has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, 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.
  • pdfcraft_js::formcalc::word_num (cognitive 17) engine/crates/js/src/formcalc.rs:2053 — pdfcraft_js::formcalc::word_num has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · pdfcraft_optimize · ×12
  • pdfcraft_optimize::optimize_with_progress (cognitive 66) engine/crates/optimize/src/lib.rs:283 — pdfcraft_optimize::optimize_with_progress has cognitive complexity 66 (threshold 15). Drivers by points: if/else 25 (49 pts), loops 5 (10 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_optimize::unused::remove_unused (cognitive 38) engine/crates/optimize/src/unused.rs:228 — pdfcraft_optimize::unused::remove_unused has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 4 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_optimize::fragments::merge_page (cognitive 36) engine/crates/optimize/src/fragments.rs:233 — pdfcraft_optimize::fragments::merge_page has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_optimize::images::process (cognitive 26) engine/crates/optimize/src/images.rs:476 — pdfcraft_optimize::images::process has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 8, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_optimize::links::remove_unreferenced_dests (cognitive 26) engine/crates/optimize/src/links.rs:183 — pdfcraft_optimize::links::remove_unreferenced_dests has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (6 pts), loops 2 (5 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.
  • pdfcraft_optimize::audit::audit_space (cognitive 24) engine/crates/optimize/src/audit.rs:202 — pdfcraft_optimize::audit::audit_space has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (13 pts), if/else 8 (11 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • pdfcraft_optimize::links::remove_invalid (cognitive 22) engine/crates/optimize/src/links.rs:90 — pdfcraft_optimize::links::remove_invalid has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, 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.
  • pdfcraft_optimize::images::run (cognitive 20) engine/crates/optimize/src/images.rs:535 — pdfcraft_optimize::images::run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_optimize::links::tree_entries (cognitive 20) engine/crates/optimize/src/links.rs:29 — pdfcraft_optimize::links::tree_entries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_optimize::unused::data (cognitive 20) engine/crates/optimize/src/unused.rs:171 — pdfcraft_optimize::unused::data has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, match/switch 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_optimize::lzw_to_flate (cognitive 16) engine/crates/optimize/src/lib.rs:434 — pdfcraft_optimize::lzw_to_flate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_optimize::unused::find_names (cognitive 16) engine/crates/optimize/src/unused.rs:124 — pdfcraft_optimize::unused::find_names has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D5 · Coupling · Off the main sequence · ×12
  • Off the main sequence: pdfcraft-compare — pdfcraft-compare: 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: pdfcraft-crypt — pdfcraft-crypt: 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: pdfcraft-export — pdfcraft-export: 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: pdfcraft-filters — pdfcraft-filters: 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: pdfcraft-geom — pdfcraft-geom: 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: pdfcraft-js — pdfcraft-js: 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: pdfcraft-platform — pdfcraft-platform: 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: pdfcraft-model — pdfcraft-model: abstractness 0.00, instability 0.07, distance 0.93 — zone of pain — concrete and depended on by 14 project(s), so it's rigid to change.
  • Off the main sequence: :backdrop — :backdrop: abstractness 0.08, instability 0.00, distance 0.92 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: pdfcraft-fonts — pdfcraft-fonts: abstractness 0.00, instability 0.08, distance 0.92 — zone of pain — concrete and depended on by 11 project(s), so it's rigid to change.
  • Off the main sequence: pdfcraft-cos — pdfcraft-cos: abstractness 0.00, instability 0.09, distance 0.91 — zone of pain — concrete and depended on by 21 project(s), so it's rigid to change.
  • Off the main sequence: pdfcraft-content — pdfcraft-content: abstractness 0.00, instability 0.09, distance 0.91 — zone of pain — concrete and depended on by 10 project(s), so it's rigid to change.
D1 · Cyclomatic Complexity · pdfcraft_sign · ×11
  • pdfcraft_sign::pdf::classify_changes (cyclomatic 53) engine/crates/sign/src/pdf.rs:1335 — pdfcraft_sign::pdf::classify_changes has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_sign::pdf::appearance (cyclomatic 43) engine/crates/sign/src/pdf.rs:2341 — pdfcraft_sign::pdf::appearance has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_sign::pdf::validate_into (cyclomatic 31) engine/crates/sign/src/pdf.rs:719 — pdfcraft_sign::pdf::validate_into has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_sign::pdf::change_kind (cyclomatic 29) engine/crates/sign/src/pdf.rs:1835 — pdfcraft_sign::pdf::change_kind has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_sign::pdf::finish_validation (cyclomatic 28) engine/crates/sign/src/pdf.rs:882 — pdfcraft_sign::pdf::finish_validation 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.
  • pdfcraft_sign::pdf::validate_doc_timestamp (cyclomatic 23) engine/crates/sign/src/pdf.rs:1146 — pdfcraft_sign::pdf::validate_doc_timestamp has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_sign::pdf::sign_inner (cyclomatic 23) engine/crates/sign/src/pdf.rs:2049 — pdfcraft_sign::pdf::sign_inner 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.
  • pdfcraft_sign::pdf::signed_page_resources (cyclomatic 19) engine/crates/sign/src/pdf.rs:1734 — pdfcraft_sign::pdf::signed_page_resources has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (reach, resources). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
  • pdfcraft_sign::pkcs12::pbe_decrypt (cyclomatic 19) engine/crates/sign/src/pkcs12.rs:222 — pdfcraft_sign::pkcs12::pbe_decrypt has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_sign::cms::parse_signer (cyclomatic 17) engine/crates/sign/src/cms.rs:240 — pdfcraft_sign::cms::parse_signer 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.
  • pdfcraft_sign::pdf::check_dss_revocation (cyclomatic 16) engine/crates/sign/src/pdf.rs:1076 — pdfcraft_sign::pdf::check_dss_revocation has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×11
  • Duplicated block (8 lines × 2) engine/crates/annot/src/lib.rs:745 — engine/crates/annot/src/lib.rs:745-752 | engine/crates/forms/src/lib.rs:509-516 — 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 `engine/crates/annot/src/lib.rs:745` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) engine/crates/create/src/lib.rs:333 — engine/crates/create/src/lib.rs:333-340 | engine/crates/xfa/src/image.rs:150-157 — 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) engine/crates/edit/src/inline_forms.rs:897 — engine/crates/edit/src/inline_forms.rs:897-904 | engine/crates/edit/src/text.rs:827-834 — 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) engine/crates/xfa/src/layout.rs:1082 — engine/crates/xfa/src/layout.rs:1082-1089 | engine/crates/xfa/src/layout.rs:1626-1633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/xfa/src/layout.rs:1082` it does not close everything it opens, so those exact lines 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) engine/crates/create/src/office/docx.rs:1232 — engine/crates/create/src/office/docx.rs:1232-1239 | engine/crates/create/src/office/docx.rs:1274-1281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/create/src/office/docx.rs:1232` 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) engine/crates/js/src/formcalc.rs:1902 — engine/crates/js/src/formcalc.rs:1902-1909 | engine/crates/js/src/formcalc.rs:1971-1978 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/js/src/formcalc.rs:1902` it does not close everything it opens, so those exact lines 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) engine/crates/annot/src/lib.rs:2414 — engine/crates/annot/src/lib.rs:2414-2421 | engine/crates/render/src/inspect.rs:1501-1508 — 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 (8 lines × 2) engine/crates/cos/src/document.rs:1530 — engine/crates/cos/src/document.rs:1530-1537 | engine/crates/cos/src/document.rs:1832-1839 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) engine/crates/create/src/office/xlsx.rs:1073 — engine/crates/create/src/office/xlsx.rs:1073-1080 | engine/crates/create/src/office/xlsx.rs:1081-1088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) engine/crates/edit/src/added.rs:85 — engine/crates/edit/src/added.rs:85-92 | engine/crates/xfa/src/text.rs:40-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:1013 — android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:1013-1020 | android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:1324-1331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:1013` 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.
D1 · Cyclomatic Complexity · pdfcraft_engine · ×10
  • pdfcraft_engine::run_edit (cyclomatic 144) engine/crates/engine/src/lib.rs:2548 — pdfcraft_engine::run_edit has cyclomatic complexity 144 (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.
  • pdfcraft_engine::commands::is_enabled (cyclomatic 25) engine/crates/engine/src/commands.rs:399 — pdfcraft_engine::commands::is_enabled has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_engine::camera_edges::hough (cyclomatic 22) engine/crates/engine/src/camera_edges.rs:162 — pdfcraft_engine::camera_edges::hough has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_engine::word_count::exclusions (cyclomatic 21) engine/crates/engine/src/word_count.rs:129 — pdfcraft_engine::word_count::exclusions 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.
  • pdfcraft_engine::signature_scan::box_blur (cyclomatic 18) engine/crates/engine/src/signature_scan.rs:279 — pdfcraft_engine::signature_scan::box_blur has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_engine::comment_summary (cyclomatic 17) engine/crates/engine/src/lib.rs:5563 — pdfcraft_engine::comment_summary has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_engine::add_annotation (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_engine::camera_clean::background (cyclomatic 16) engine/crates/engine/src/camera_clean.rs:145 — pdfcraft_engine::camera_clean::background has cyclomatic complexity 16 (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.
  • pdfcraft_engine::dates::format_day (cyclomatic 16) engine/crates/engine/src/dates.rs:640 — pdfcraft_engine::dates::format_day has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_engine::scan_colours::sample (cyclomatic 16) engine/crates/engine/src/scan_colours.rs:19 — pdfcraft_engine::scan_colours::sample has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_engine::text_fonts::discover (cyclomatic 16) engine/crates/engine/src/text_fonts.rs:37 — pdfcraft_engine::text_fonts::discover 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 · pdfcraft_render · ×10
  • pdfcraft_render::raster::worker (cognitive 145) engine/crates/render/src/raster.rs:1015 — pdfcraft_render::raster::worker has cognitive complexity 145 (threshold 15). Drivers by points: if/else 39 (120 pts), boolean chains 11, loops 3 (7 pts), match/switch 2 (7 pts) (nesting depth added 90). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::text::arrange (cognitive 118) engine/crates/render/src/text.rs:1491 — pdfcraft_render::text::arrange has cognitive complexity 118 (threshold 15). Drivers by points: if/else 29 (77 pts), loops 13 (22 pts), boolean chains 17, match/switch 1 (2 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::text::reverse_rtl (cognitive 59) engine/crates/render/src/text.rs:1348 — pdfcraft_render::text::reverse_rtl has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 12 (17 pts), boolean chains 8, match/switch 3 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::text::extract_page_filtered (cognitive 39) engine/crates/render/src/text.rs:734 — pdfcraft_render::text::extract_page_filtered has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 9 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::text::search::find (cognitive 39) engine/crates/render/src/text/search.rs:5 — pdfcraft_render::text::search::find has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 6, loops 4 (5 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.
  • pdfcraft_render::text::collide (cognitive 33) engine/crates/render/src/text.rs:1216 — pdfcraft_render::text::collide has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 9 (14 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::transition::frame (cognitive 24) engine/crates/render/src/transition.rs:171 — pdfcraft_render::transition::frame has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::inspect::inspect (cognitive 20) engine/crates/render/src/inspect.rs:695 — pdfcraft_render::inspect::inspect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::inspect::xml_child_body (cognitive 17) engine/crates/render/src/inspect.rs:2291 — pdfcraft_render::inspect::xml_child_body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_render::raster::render_page (cognitive 17) engine/crates/render/src/raster.rs:311 — pdfcraft_render::raster::render_page has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, match/switch 4 (5 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inspector · ×10
  • Inspector::page_labels (cognitive 70) engine/crates/render/src/inspect.rs:1294 — Inspector::page_labels has cognitive complexity 70 (threshold 15). Drivers by points: if/else 23 (52 pts), loops 6 (10 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::annotations (cognitive 64) engine/crates/render/src/inspect.rs:1430 — Inspector::annotations has cognitive complexity 64 (threshold 15). Drivers by points: if/else 20 (46 pts), match/switch 4 (8 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::fill (cognitive 44) engine/crates/render/src/inspect.rs:830 — Inspector::fill has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 8, loops 4 (8 pts), match/switch 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::name_tree_find (cognitive 28) engine/crates/render/src/inspect.rs:1188 — Inspector::name_tree_find has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 3 (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.
  • Inspector::name_tree (cognitive 23) engine/crates/render/src/inspect.rs:1149 — Inspector::name_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 2 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::name_tree_raw (cognitive 18) engine/crates/render/src/inspect.rs:1122 — Inspector::name_tree_raw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), match/switch 1 (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.
  • Inspector::fonts (cognitive 18) engine/crates/render/src/inspect.rs:1893 — Inspector::fonts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::field (cognitive 17) engine/crates/render/src/inspect.rs:1719 — Inspector::field has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, match/switch 5 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::transitions (cognitive 16) engine/crates/render/src/inspect.rs:961 — Inspector::transitions has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inspector::outline_window (cognitive 16) engine/crates/render/src/inspect.rs:1229 — Inspector::outline_window has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 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 · artefact_mobile · ×10
  • artefact_mobile::office::sniff (cognitive 53) engine/mobile/src/office.rs:90 — artefact_mobile::office::sniff has cognitive complexity 53 (threshold 15). Drivers by points: if/else 24 (44 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::ppt::import (cognitive 53) engine/mobile/src/ppt.rs:664 — artefact_mobile::ppt::import has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), match/switch 2 (8 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::xls_art::chart_bits (cognitive 52) engine/mobile/src/xls_art.rs:245 — artefact_mobile::xls_art::chart_bits has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (31 pts), match/switch 6 (19 pts), boolean chains 1, loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::ppt::read_group (cognitive 36) engine/mobile/src/ppt.rs:434 — artefact_mobile::ppt::read_group has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (26 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::xls_art::import (cognitive 32) engine/mobile/src/xls_art.rs:433 — artefact_mobile::xls_art::import has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::ppt::text_look (cognitive 31) engine/mobile/src/ppt.rs:291 — artefact_mobile::ppt::text_look has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::xls_art::shapes (cognitive 30) engine/mobile/src/xls_art.rs:150 — artefact_mobile::xls_art::shapes has cognitive complexity 30 (threshold 15). Drivers by points: loops 4 (14 pts), if/else 3 (10 pts), match/switch 2 (6 pts) (nesting depth added 21). 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.
  • artefact_mobile::reading_blocks (cognitive 23) engine/mobile/src/lib.rs:375 — artefact_mobile::reading_blocks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (5 pts), boolean chains 4, match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::ppt::read_shape (cognitive 18) engine/mobile/src/ppt.rs:394 — artefact_mobile::ppt::read_shape has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 2 (6 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • artefact_mobile::ppt::read_slide_list (cognitive 16) engine/mobile/src/ppt.rs:138 — artefact_mobile::ppt::read_slide_list has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×10
  • Duplicated block (9 lines × 2) engine/crates/annot/src/lib.rs:2350 — engine/crates/annot/src/lib.rs:2350-2358 | engine/crates/sign/src/pdf.rs:481-489 — 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 (9 lines × 2) engine/crates/create/src/office/draw.rs:476 — engine/crates/create/src/office/draw.rs:476-484 | engine/crates/create/src/office/draw.rs:500-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/create/src/office/draw.rs:476` 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) engine/crates/edit/src/text.rs:1700 — engine/crates/edit/src/text.rs:1700-1708 | engine/crates/edit/src/text.rs:1821-1829 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text.rs:1700` 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) engine/crates/organize/src/import.rs:1146 — engine/crates/organize/src/import.rs:1146-1154 | engine/crates/organize/src/import.rs:1229-1237 — both copies are in the same file, so extract the 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) engine/crates/cos/src/document.rs:1610 — engine/crates/cos/src/document.rs:1610-1618 | engine/crates/cos/src/document.rs:1926-1934 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/cos/src/document.rs:1610` 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) engine/crates/create/src/office/docx.rs:633 — engine/crates/create/src/office/docx.rs:633-641 | engine/crates/create/src/office/pptx.rs:59-67 — 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 `engine/crates/create/src/office/docx.rs:633` 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) engine/crates/sign/src/pdf.rs:2215 — engine/crates/sign/src/pdf.rs:2215-2223 | engine/crates/sign/src/pdf.rs:2281-2289 — both copies are in the same file, so extract the 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) engine/crates/engine/src/lib.rs:5052 — engine/crates/engine/src/lib.rs:5052-5060 | engine/crates/redact/src/lib.rs:210-218 — 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 `engine/crates/engine/src/lib.rs:5052` 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) android/backdrop/src/main/java/com/kyant/backdrop/shadow/InnerShadowModifier.kt:91 — android/backdrop/src/main/java/com/kyant/backdrop/shadow/InnerShadowModifier.kt:91-99 | android/backdrop/src/main/java/com/kyant/backdrop/shadow/ShadowModifier.kt:82-90 — 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 `android/backdrop/src/main/java/com/kyant/backdrop/shadow/InnerShadowModifier.kt:91` it does not close everything it opens, so those exact lines 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) android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.kt:58 — android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightModifier.kt:58-66 | android/backdrop/src/main/java/com/kyant/backdrop/shadow/ShadowModifier.kt:51-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 (7 lines × 2) · ×10
  • Duplicated block (7 lines × 2) engine/crates/annot/src/lib.rs:1862 — engine/crates/annot/src/lib.rs:1862-1868 | engine/crates/annot/src/lib.rs:1904-1910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/annot/src/lib.rs:1862` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) engine/crates/annot/src/lib.rs:2030 — engine/crates/annot/src/lib.rs:2030-2036 | engine/crates/annot/src/lib.rs:2663-2669 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/annot/src/lib.rs:2030` it does not close everything it opens, so those exact lines 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) engine/crates/export/src/lib.rs:950 — engine/crates/export/src/lib.rs:950-956 | engine/crates/export/src/lib.rs:976-982 — both copies are in the same file, so extract the 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, `engine/crates/export/src/lib.rs:948` calls `Para` and `engine/crates/export/src/lib.rs:974` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) engine/crates/cos/src/document.rs:1687 — engine/crates/cos/src/document.rs:1687-1693 | engine/crates/cos/src/document.rs:1972-1978 — both copies are in the same file, so extract the 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) engine/crates/edit/src/text.rs:1440 — engine/crates/edit/src/text.rs:1440-1446 | engine/crates/edit/src/text.rs:1454-1460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text.rs:1440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) engine/crates/edit/src/text.rs:3295 — engine/crates/edit/src/text.rs:3295-3301 | engine/crates/edit/src/text_regions.rs:950-956 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) engine/crates/organize/src/prune.rs:274 — engine/crates/organize/src/prune.rs:274-280 | engine/crates/organize/src/prune.rs:292-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/organize/src/prune.rs:274` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `engine/crates/organize/src/prune.rs:299` calls `set`, `to_vec`, `Dict` and `engine/crates/organize/src/prune.rs:281` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) engine/crates/cos/src/document.rs:118 — engine/crates/cos/src/document.rs:118-124 | engine/crates/cos/src/document.rs:184-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) engine/crates/engine/src/lib.rs:3493 — engine/crates/engine/src/lib.rs:3493-3499 | engine/crates/engine/src/lib.rs:4074-4080 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/engine/src/lib.rs:3493` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:976 — android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:976-982 | android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:1111-1117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:976` it does not close everything it opens, so those 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, `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:983` calls `feel` and `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:1118` 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.
D1 · Cyclomatic Complexity · pdfcraft_annot · ×9
  • pdfcraft_annot::appearance::build (cyclomatic 123) engine/crates/annot/src/appearance.rs:382 — pdfcraft_annot::appearance::build has cyclomatic complexity 123 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_annot::add_annotation (cyclomatic 54) engine/crates/annot/src/lib.rs:1152 — pdfcraft_annot::add_annotation has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_annot::rect_for (cyclomatic 32) engine/crates/annot/src/lib.rs:991 — pdfcraft_annot::rect_for has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_annot::links::email_at (cyclomatic 22) engine/crates/annot/src/links.rs:350 — pdfcraft_annot::links::email_at has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_annot::set_style (cyclomatic 20) engine/crates/annot/src/lib.rs:2127 — pdfcraft_annot::set_style has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_annot::subject (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_annot::summaries (cyclomatic 18) engine/crates/annot/src/lib.rs:2380 — pdfcraft_annot::summaries has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_annot::subject (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_annot::erase_ink (cyclomatic 16) engine/crates/annot/src/lib.rs:2653 — pdfcraft_annot::erase_ink has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_annot::subject (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_annot::appearance::rich_plain (cyclomatic 16) engine/crates/annot/src/appearance.rs:1049 — pdfcraft_annot::appearance::rich_plain has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_annot::appearance::line_layout (cyclomatic 16) engine/crates/annot/src/appearance.rs:1142 — pdfcraft_annot::appearance::line_layout has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pdfcraft_render · ×9
  • pdfcraft_render::text::arrange (cyclomatic 56) engine/crates/render/src/text.rs:1491 — pdfcraft_render::text::arrange has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_render::raster::worker (cyclomatic 53) engine/crates/render/src/raster.rs:1015 — pdfcraft_render::raster::worker has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_render::text::reverse_rtl (cyclomatic 39) engine/crates/render/src/text.rs:1348 — pdfcraft_render::text::reverse_rtl has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_render::transition::frame (cyclomatic 28) engine/crates/render/src/transition.rs:171 — pdfcraft_render::transition::frame has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_render::text::extract_page_filtered (cyclomatic 24) engine/crates/render/src/text.rs:734 — pdfcraft_render::text::extract_page_filtered has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_render::text::search::find (cyclomatic 23) engine/crates/render/src/text/search.rs:5 — pdfcraft_render::text::search::find 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.
  • pdfcraft_render::text::collide (cyclomatic 19) engine/crates/render/src/text.rs:1216 — pdfcraft_render::text::collide 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.
  • pdfcraft_render::inspect::inspect (cyclomatic 18) engine/crates/render/src/inspect.rs:695 — pdfcraft_render::inspect::inspect 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.
  • pdfcraft_render::raster::render_page (cyclomatic 17) engine/crates/render/src/raster.rs:311 — pdfcraft_render::raster::render_page has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · pdfcraft_xfdf · ×9
  • pdfcraft_xfdf::xfdf_annots (cognitive 81) engine/crates/xfdf/src/lib.rs:287 — pdfcraft_xfdf::xfdf_annots has cognitive complexity 81 (threshold 15). Drivers by points: if/else 24 (65 pts), loops 6 (13 pts), boolean chains 3 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::export_fdf (cognitive 61) engine/crates/xfdf/src/lib.rs:693 — pdfcraft_xfdf::export_fdf has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (38 pts), loops 9 (19 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • pdfcraft_xfdf::annot_from_xml (cognitive 32) engine/crates/xfdf/src/lib.rs:921 — pdfcraft_xfdf::annot_from_xml has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (23 pts), match/switch 2 (4 pts), boolean chains 3, 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.
  • pdfcraft_xfdf::import_xfdf (cognitive 31) engine/crates/xfdf/src/lib.rs:1129 — pdfcraft_xfdf::import_xfdf has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::xml_nesting_depth (cognitive 28) engine/crates/xfdf/src/lib.rs:97 — pdfcraft_xfdf::xml_nesting_depth has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::walk_fdf (cognitive 22) engine/crates/xfdf/src/lib.rs:1288 — pdfcraft_xfdf::walk_fdf has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::place (cognitive 20) engine/crates/xfdf/src/lib.rs:1047 — pdfcraft_xfdf::place has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::import_fdf (cognitive 17) engine/crates/xfdf/src/lib.rs:1429 — pdfcraft_xfdf::import_fdf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_xfdf::import_table (cognitive 17) engine/crates/xfdf/src/lib.rs:1506 — pdfcraft_xfdf::import_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D3 · God Classes · ClassTooLong · ×9
  • ClassTooLong: AppViewModel android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:71 — ClassTooLong — 2177 significant lines (blank, comment-only and punctuation-only lines excluded), 240 methods. The bar is 400 significant lines; this is 1777 over it, 5.44× 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: Automation engine/crates/automation/src/lib.rs:117 — ClassTooLong — 1729 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 179 methods, 3 blocks, lines 117-2399. The bar is 400 significant lines; this is 1329 over it, 4.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Session engine/crates/engine/src/lib.rs:3229 — ClassTooLong — 1167 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 117 methods, 2 blocks, lines 3229-5413. The bar is 400 significant lines; this is 767 over it, 2.92× 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: Document engine/crates/cos/src/document.rs:406 — ClassTooLong — 1066 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 77 methods, 3 blocks, lines 406-2219. The bar is 400 significant lines; this is 666 over it, 2.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Inspector engine/crates/render/src/inspect.rs:802 — ClassTooLong — 794 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 2 blocks, lines 802-1982. The bar is 400 significant lines; this is 394 over it, 1.99× 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: Converter engine/crates/create/src/office/docx.rs:649 — ClassTooLong — 477 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 14 methods, 2 blocks, lines 649-1446. The bar is 400 significant lines; this is 77 over it, 1.19× 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 engine/crates/engine/src/lib.rs:1386 — ClassTooLong — 454 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 2 blocks, lines 1386-2274. The bar is 400 significant lines; this is 54 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: SheetBook engine/mobile/src/sheets.rs:153 — ClassTooLong — 428 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, 3 blocks, lines 153-749. The bar is 400 significant lines; this is 28 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: Renderer engine/crates/create/src/office/pptx.rs:820 — ClassTooLong — 407 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 2 blocks, lines 820-1347. The bar is 400 significant lines; this is 7 over it, 1.02× 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.
D1 · Cyclomatic Complexity · Interp · ×8
  • Interp::builtin_inner (cyclomatic 157) engine/crates/js/src/formcalc.rs:2099 — Interp::builtin_inner has cyclomatic complexity 157 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Interp::member (cyclomatic 42) engine/crates/js/src/formcalc.rs:1019 — Interp::member has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Interp::exec (cyclomatic 36) engine/crates/js/src/formcalc.rs:1704 — Interp::exec has cyclomatic complexity 36 (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.
  • Interp::method (cyclomatic 33) engine/crates/js/src/formcalc.rs:1460 — Interp::method has cyclomatic complexity 33 (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.
  • Interp::node_member (cyclomatic 25) engine/crates/js/src/formcalc.rs:1104 — Interp::node_member has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Interp::eval_inner (cyclomatic 24) engine/crates/js/src/formcalc.rs:1243 — Interp::eval_inner has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Interp::binary (cyclomatic 22) engine/crates/js/src/formcalc.rs:1326 — Interp::binary 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.
  • Interp::assign_to (cyclomatic 18) engine/crates/js/src/formcalc.rs:1607 — Interp::assign_to has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · Interp · ×8
  • Interp::builtin_inner (cognitive 202) engine/crates/js/src/formcalc.rs:2099 — Interp::builtin_inner has cognitive complexity 202 (threshold 15). Drivers by points: if/else 82 (149 pts), boolean chains 21, match/switch 9 (18 pts), loops 6 (14 pts) (nesting depth added 84). 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.
  • Interp::eval_inner (cognitive 40) engine/crates/js/src/formcalc.rs:1243 — Interp::eval_inner has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 3 (6 pts), match/switch 3 (6 pts) (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Interp::exec (cognitive 39) engine/crates/js/src/formcalc.rs:1704 — Interp::exec has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 7 (12 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Interp::assign_to (cognitive 32) engine/crates/js/src/formcalc.rs:1607 — Interp::assign_to has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (5 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Interp::method (cognitive 29) engine/crates/js/src/formcalc.rs:1460 — Interp::method has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 8 (17 pts), if/else 4 (10 pts), boolean chains 2 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Interp::member (cognitive 24) engine/crates/js/src/formcalc.rs:1019 — Interp::member has cognitive complexity 24 (threshold 15). Drivers by points: match/switch 7 (14 pts), loops 2 (6 pts), if/else 2 (4 pts) (nesting depth added 13). 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.
  • Interp::node_member (cognitive 18) engine/crates/js/src/formcalc.rs:1104 — Interp::node_member has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 5 (8 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Interp::binary (cognitive 17) engine/crates/js/src/formcalc.rs:1326 — Interp::binary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · pdfcraft_fonts · ×8
  • pdfcraft_fonts::pdf::parse_to_unicode_within (cognitive 69) engine/crates/fonts/src/pdf.rs:1119 — pdfcraft_fonts::pdf::parse_to_unicode_within has cognitive complexity 69 (threshold 15). Drivers by points: if/else 9 (44 pts), loops 4 (12 pts), match/switch 3 (12 pts), boolean chains 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_fonts::pdf::embedded_sfnt_within (cognitive 34) engine/crates/fonts/src/pdf.rs:103 — pdfcraft_fonts::pdf::embedded_sfnt_within has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 2 (3 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.
  • pdfcraft_fonts::embedding::embed_mapping (cognitive 29) engine/crates/fonts/src/embedding.rs:121 — pdfcraft_fonts::embedding::embed_mapping has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • pdfcraft_fonts::pdf::unicode_map (cognitive 29) engine/crates/fonts/src/pdf.rs:1232 — pdfcraft_fonts::pdf::unicode_map has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 4 (8 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 16). 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.
  • pdfcraft_fonts::pdf::parse_cmap (cognitive 27) engine/crates/fonts/src/pdf.rs:565 — pdfcraft_fonts::pdf::parse_cmap has cognitive complexity 27 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 4 (10 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_fonts::wrap_with (cognitive 26) engine/crates/fonts/src/lib.rs:101 — pdfcraft_fonts::wrap_with has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_fonts::source_shaping::shape (cognitive 24) engine/crates/fonts/src/source_shaping.rs:25 — pdfcraft_fonts::source_shaping::shape has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_fonts::script::script_outline (cognitive 18) engine/crates/fonts/src/script.rs:301 — pdfcraft_fonts::script::script_outline has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×8
  • Edited copy of a member (10 corresponding lines) engine/crates/create/src/office/docx.rs:628 — engine/crates/create/src/office/docx.rs:628-641 | engine/crates/create/src/office/pptx.rs:26-67 — 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) engine/crates/engine/src/lib.rs:5031 — engine/crates/engine/src/lib.rs:5031-5071 | engine/crates/redact/src/lib.rs:184-235 — 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) engine/crates/xfa/src/data.rs:747 — engine/crates/xfa/src/data.rs:747-757 | engine/crates/xfa/src/data.rs:760-769 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) engine/crates/render/src/inspect.rs:522 — engine/crates/render/src/inspect.rs:522-531 | engine/crates/render/src/inspect.rs:535-546 — 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) engine/crates/filters/src/predictor.rs:96 — engine/crates/filters/src/predictor.rs:96-105 | engine/crates/filters/src/predictor.rs:107-118 — 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) engine/crates/organize/src/attachments.rs:86 — engine/crates/organize/src/attachments.rs:86-98 | engine/crates/organize/src/import.rs:1372-1381 — 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) engine/crates/engine/src/lib.rs:5244 — engine/crates/engine/src/lib.rs:5244-5253 | engine/crates/engine/src/lib.rs:5257-5266 — 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) engine/crates/create/src/office/xlsx.rs:341 — engine/crates/create/src/office/xlsx.rs:341-351 | engine/crates/forms/src/af.rs:831-840 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×8
  • Edited copy of a member (6 corresponding lines) engine/crates/forms/src/af.rs:890 — engine/crates/forms/src/af.rs:890-896 | engine/crates/xfa/src/data.rs:352-357 — 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) android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt:97 — android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt:97-104 | android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt:107-112 — 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) engine/crates/automation/src/comments.rs:600 — engine/crates/automation/src/comments.rs:600-606 | engine/crates/automation/src/comments.rs:608-613 — 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) engine/crates/create/src/office/pptx.rs:179 — engine/crates/create/src/office/pptx.rs:179-184 | engine/crates/create/src/office/pptx.rs:217-223 — 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) engine/crates/xfa/src/script.rs:109 — engine/crates/xfa/src/script.rs:109-115 | engine/crates/forms/src/lib.rs:527-532 — 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) engine/crates/preflight/src/lib.rs:164 — engine/crates/preflight/src/lib.rs:164-171 | engine/crates/organize/src/pdfx.rs:167-172 — 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) engine/crates/edit/src/bidi.rs:47 — engine/crates/edit/src/bidi.rs:47-53 | engine/crates/redact/src/patterns.rs:202-207 — 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) android/backdrop/src/main/java/com/kyant/backdrop/effects/ColorFilter.kt:79 — android/backdrop/src/main/java/com/kyant/backdrop/effects/ColorFilter.kt:79-86 | android/backdrop/src/main/java/com/kyant/backdrop/effects/RenderEffect.kt:43-48 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×8
  • Edited copy of a member (4 corresponding lines) engine/crates/cos/src/object.rs:285 — engine/crates/cos/src/object.rs:285-290 | engine/crates/cos/src/object.rs:325-328 — 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) engine/crates/automation/src/comments.rs:78 — engine/crates/automation/src/comments.rs:78-81 | engine/crates/render/src/inspect.rs:292-295 — 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) engine/crates/organize/src/lib.rs:665 — engine/crates/organize/src/lib.rs:665-673 | engine/crates/preflight/src/xmp.rs:172-175 — 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) engine/crates/a11y/src/alt.rs:149 — engine/crates/a11y/src/alt.rs:149-152 | engine/crates/edit/src/lib.rs:367-370 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) engine/crates/create/src/office/docx.rs:285 — engine/crates/create/src/office/docx.rs:285-288 | engine/crates/create/src/office/docx.rs:290-293 — 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) engine/crates/sign/src/keychain.rs:38 — engine/crates/sign/src/keychain.rs:38-41 | engine/crates/sign/src/windows.rs:67-70 — 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) engine/crates/engine/src/lib.rs:600 — engine/crates/engine/src/lib.rs:600-603 | engine/crates/engine/src/text_preview.rs:57-62 — 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) engine/crates/edit/src/flatten.rs:21 — engine/crates/edit/src/flatten.rs:21-24 | engine/crates/forms/src/lib.rs:467-470 — 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 · Edited copy of a member (5 corresponding lines) · ×8
  • Edited copy of a member (5 corresponding lines) engine/crates/edit/src/images.rs:408 — engine/crates/edit/src/images.rs:408-412 | engine/crates/sign/src/graphic.rs:64-69 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) engine/crates/edit/src/text.rs:2761 — engine/crates/edit/src/text.rs:2761-2766 | engine/crates/export/src/lib.rs:617-621 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt:209 — android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt:209-214 | android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt:216-220 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) engine/crates/automation/src/lib.rs:2505 — engine/crates/automation/src/lib.rs:2505-2509 | engine/crates/automation/src/lib.rs:2531-2535 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/widget/ArtefactWidgets.kt:475 — android/app/src/main/java/com/chethan616/clearpdf/widget/ArtefactWidgets.kt:475-479 | android/app/src/main/java/com/chethan616/clearpdf/widget/ArtefactWidgets.kt:481-486 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt:175 — android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt:175-179 | android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt:252-259 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) engine/crates/annot/src/lib.rs:705 — engine/crates/annot/src/lib.rs:705-709 | engine/crates/organize/src/lib.rs:69-73 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) engine/crates/js/src/lib.rs:719 — engine/crates/js/src/lib.rs:719-723 | engine/crates/js/src/xfa.rs:1221-1225 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D1 · Cyclomatic Complexity · pdfcraft_optimize · ×7
  • pdfcraft_optimize::optimize_with_progress (cyclomatic 37) engine/crates/optimize/src/lib.rs:283 — pdfcraft_optimize::optimize_with_progress has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_optimize::fragments::merge_page (cyclomatic 23) engine/crates/optimize/src/fragments.rs:233 — pdfcraft_optimize::fragments::merge_page 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.
  • pdfcraft_optimize::unused::data (cyclomatic 23) engine/crates/optimize/src/unused.rs:171 — pdfcraft_optimize::unused::data has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_optimize::images::process (cyclomatic 21) engine/crates/optimize/src/images.rs:476 — pdfcraft_optimize::images::process has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_optimize::unused::remove_unused (cyclomatic 21) engine/crates/optimize/src/unused.rs:228 — pdfcraft_optimize::unused::remove_unused 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.
  • pdfcraft_optimize::audit::audit_space (cyclomatic 17) engine/crates/optimize/src/audit.rs:202 — pdfcraft_optimize::audit::audit_space has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • pdfcraft_optimize::lzw_to_flate (cyclomatic 16) engine/crates/optimize/src/lib.rs:434 — pdfcraft_optimize::lzw_to_flate has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · pdfcraft_organize · ×7
  • pdfcraft_organize::view::set_initial_view (cyclomatic 33) engine/crates/organize/src/view.rs:167 — pdfcraft_organize::view::set_initial_view has cyclomatic complexity 33 (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.
  • pdfcraft_organize::view::initial_view (cyclomatic 30) engine/crates/organize/src/view.rs:78 — pdfcraft_organize::view::initial_view has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_organize::import::import_pages_mapped (cyclomatic 28) engine/crates/organize/src/import.rs:377 — pdfcraft_organize::import::import_pages_mapped 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.
  • pdfcraft_organize::labels::read_label_node (cyclomatic 20) engine/crates/organize/src/labels.rs:142 — pdfcraft_organize::labels::read_label_node has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_organize::dedupe::dedupe_resources (cyclomatic 17) engine/crates/organize/src/dedupe.rs:193 — pdfcraft_organize::dedupe::dedupe_resources 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.
  • pdfcraft_organize::boxes::set_page_box (cyclomatic 16) engine/crates/organize/src/boxes.rs:81 — pdfcraft_organize::boxes::set_page_box 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.
  • pdfcraft_organize::prune::filter_at (cyclomatic 16) engine/crates/organize/src/prune.rs:265 — pdfcraft_organize::prune::filter_at 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 · pdfcraft_export · ×7
  • pdfcraft_export::tables (cognitive 70) engine/crates/export/src/lib.rs:196 — pdfcraft_export::tables has cognitive complexity 70 (threshold 15). Drivers by points: if/else 14 (30 pts), loops 12 (21 pts), boolean chains 11, match/switch 3 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_export::rtf (cognitive 43) engine/crates/export/src/lib.rs:912 — pdfcraft_export::rtf has cognitive complexity 43 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 6 (15 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_export::html (cognitive 40) engine/crates/export/src/lib.rs:464 — pdfcraft_export::html has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_export::docx (cognitive 39) engine/crates/export/src/lib.rs:763 — pdfcraft_export::docx has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 2 (9 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_export::pptx::table (cognitive 25) engine/crates/export/src/pptx.rs:207 — pdfcraft_export::pptx::table has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_export::xlsx::xlsx (cognitive 20) engine/crates/export/src/xlsx.rs:399 — pdfcraft_export::xlsx::xlsx has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (5 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.
  • pdfcraft_export::xlsx::plain_number (cognitive 18) engine/crates/export/src/xlsx.rs:31 — pdfcraft_export::xlsx::plain_number has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D3 · God Classes · TooManyMethods · ×7
  • TooManyMethods: AppViewModel android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:71 — TooManyMethods — 240 methods. The bar is 30 methods; this is 210 over it, 8.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Automation engine/crates/automation/src/lib.rs:117 — TooManyMethods — 179 methods, declared across 14 files: src/lib.rs (56), src/a11y.rs (44), src/comments.rs (16), src/forms.rs (13), +10 more file(s). The bar is 30 methods; this is 149 over it, 5.97× 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: Session engine/crates/engine/src/lib.rs:3229 — TooManyMethods — 117 methods, declared across 8 files: src/lib.rs (91), src/js.rs (7), src/dates.rs (6), src/compare.rs (4), +4 more file(s). The bar is 30 methods; this is 87 over it, 3.90× 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: Document engine/crates/engine/src/lib.rs:398 — TooManyMethods — 83 methods, declared across 9 files: src/lib.rs (59), src/compare.rs (8), src/text_preview.rs (5), src/copy_image.rs (4), +5 more file(s). The bar is 30 methods; this is 53 over it, 2.77× 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: Document engine/crates/cos/src/document.rs:406 — TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MobileSession engine/mobile/src/lib.rs:460 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Inspector engine/crates/render/src/inspect.rs:802 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×7
  • Edited copy of a member (7 corresponding lines) engine/crates/annot/src/appearance.rs:284 — engine/crates/annot/src/appearance.rs:284-292 | engine/crates/xfa/src/pdf.rs:209-215 — 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) engine/crates/a11y/src/alt.rs:155 — engine/crates/a11y/src/alt.rs:155-161 | engine/crates/a11y/src/content.rs:56-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) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:264 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:264-270 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerOverlays.kt:269-277 — 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) engine/crates/automation/src/a11y.rs:418 — engine/crates/automation/src/a11y.rs:418-424 | engine/crates/automation/src/a11y.rs:970-976 — 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) engine/crates/forms/src/appearance.rs:627 — engine/crates/forms/src/appearance.rs:627-633 | engine/crates/forms/src/appearance.rs:637-643 — 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) engine/crates/optimize/src/links.rs:69 — engine/crates/optimize/src/links.rs:69-75 | engine/crates/organize/src/outline.rs:230-236 — 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) engine/crates/js/src/lib.rs:270 — engine/crates/js/src/lib.rs:270-276 | engine/crates/js/src/xfa.rs:419-425 — 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.
D1 · Cyclomatic Complexity · artefact_mobile · ×6
  • artefact_mobile::xls_art::chart_bits (cyclomatic 45) engine/mobile/src/xls_art.rs:245 — artefact_mobile::xls_art::chart_bits has cyclomatic complexity 45 (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.
  • artefact_mobile::office::sniff (cyclomatic 28) engine/mobile/src/office.rs:90 — artefact_mobile::office::sniff 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.
  • artefact_mobile::ppt::import (cyclomatic 23) engine/mobile/src/ppt.rs:664 — artefact_mobile::ppt::import 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.
  • artefact_mobile::ppt::read_group (cyclomatic 19) engine/mobile/src/ppt.rs:434 — artefact_mobile::ppt::read_group 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.
  • artefact_mobile::ppt::text_look (cyclomatic 18) engine/mobile/src/ppt.rs:291 — artefact_mobile::ppt::text_look has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • artefact_mobile::reading_blocks (cyclomatic 16) engine/mobile/src/lib.rs:375 — artefact_mobile::reading_blocks has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · pdfcraft_a11y · ×6
  • pdfcraft_a11y::headings::mcid_texts (cyclomatic 42) engine/crates/a11y/src/headings.rs:181 — pdfcraft_a11y::headings::mcid_texts has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_a11y::content::page_rule (cyclomatic 36) engine/crates/a11y/src/content.rs:262 — pdfcraft_a11y::content::page_rule has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_a11y::alt::content_bboxes (cyclomatic 24) engine/crates/a11y/src/alt.rs:235 — pdfcraft_a11y::alt::content_bboxes has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_a11y::check (cyclomatic 19) engine/crates/a11y/src/lib.rs:632 — pdfcraft_a11y::check has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Rule::info (cyclomatic 32) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • pdfcraft_a11y::autotag_fields::tag_form_fields (cyclomatic 19) engine/crates/a11y/src/autotag_fields.rs:30 — pdfcraft_a11y::autotag_fields::tag_form_fields 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.
  • pdfcraft_a11y::content::document_rule (cyclomatic 17) engine/crates/a11y/src/content.rs:177 — pdfcraft_a11y::content::document_rule 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.
D2 · Cognitive Complexity · pdfcraft_print · ×6
  • pdfcraft_print::layout (cognitive 156) engine/crates/print/src/lib.rs:496 — pdfcraft_print::layout has cognitive complexity 156 (threshold 15). Drivers by points: if/else 33 (93 pts), loops 13 (41 pts), boolean chains 11, match/switch 4 (11 pts) (nesting depth added 95). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_print::spool::localize (cognitive 33) engine/crates/print/src/spool.rs:183 — pdfcraft_print::spool::localize has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (29 pts), 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.
  • pdfcraft_print::range::select_pages (cognitive 30) engine/crates/print/src/range.rs:50 — pdfcraft_print::range::select_pages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (23 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pdfcraft_print::page_form (cognitive 29) engine/crates/print/src/lib.rs:855 — pdfcraft_print::page_form has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_print::text_direction (cognitive 21) engine/crates/print/src/lib.rs:379 — pdfcraft_print::text_direction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_print::impose (cognitive 17) engine/crates/print/src/lib.rs:955 — pdfcraft_print::impose has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Document · ×6
  • Document::read_compact_section (cognitive 110) engine/crates/cos/src/document.rs:1632 — Document::read_compact_section has cognitive complexity 110 (threshold 15). Drivers by points: if/else 35 (92 pts), loops 6 (10 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Document::read_section (cognitive 65) engine/crates/cos/src/document.rs:1940 — Document::read_section has cognitive complexity 65 (threshold 15). Drivers by points: if/else 19 (48 pts), loops 4 (8 pts), match/switch 3 (8 pts), boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Document::read_compact_xref_chain (cognitive 50) engine/crates/cos/src/document.rs:1529 — Document::read_compact_xref_chain has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 4 (9 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Document::read_xref_chain_materialized (cognitive 49) engine/crates/cos/src/document.rs:1828 — Document::read_xref_chain_materialized has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 5 (12 pts), match/switch 4 (11 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Document::reconstruct (cognitive 33) engine/crates/cos/src/document.rs:2120 — Document::reconstruct has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 6 (8 pts), boolean chains 6, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Document::export_pages_checked (cognitive 19) engine/crates/engine/src/compare.rs:196 — Document::export_pages_checked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 4, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Converter · ×6
  • Converter::table (cognitive 109) engine/crates/create/src/office/docx.rs:1283 — Converter::table has cognitive complexity 109 (threshold 15). Drivers by points: if/else 32 (76 pts), loops 6 (15 pts), boolean chains 12, match/switch 3 (6 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Converter::run (cognitive 38) engine/crates/create/src/office/docx.rs:1124 — Converter::run has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (20 pts), match/switch 4 (13 pts), loops 2 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Converter::paragraph (cognitive 25) engine/crates/create/src/office/docx.rs:968 — Converter::paragraph has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 2 (3 pts), boolean chains 2, 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.
  • Converter::vml (cognitive 18) engine/crates/create/src/office/docx.rs:1242 — Converter::vml has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Converter::setup (cognitive 17) engine/crates/create/src/office/docx.rs:821 — Converter::setup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Converter::block (cognitive 16) engine/crates/create/src/office/docx.rs:904 — Converter::block has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (8 pts), if/else 4 (7 pts), match/switch 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Layouter · ×6
  • Layouter::draw_node (cognitive 51) engine/crates/xfa/src/layout.rs:1546 — Layouter::draw_node has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 6 (18 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Layouter::split_block (cognitive 46) engine/crates/xfa/src/layout.rs:897 — Layouter::split_block has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 4 (7 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Layouter::draw_field (cognitive 46) engine/crates/xfa/src/layout.rs:1836 — Layouter::draw_field has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (21 pts), match/switch 12 (20 pts), boolean chains 5 (nesting depth added 12). 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.
  • Layouter::flow_subform (cognitive 28) engine/crates/xfa/src/layout.rs:993 — Layouter::flow_subform has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Layouter::flow_table (cognitive 19) engine/crates/xfa/src/layout.rs:1071 — Layouter::flow_table has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Layouter::draw_border (cognitive 16) engine/crates/xfa/src/layout.rs:1656 — Layouter::draw_border has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×6
  • Edited copy of a member (9 corresponding lines) engine/crates/forms/src/author.rs:500 — engine/crates/forms/src/author.rs:500-508 | engine/crates/redact/src/lib.rs:157-165 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) engine/crates/engine/src/text_preview.rs:71 — engine/crates/engine/src/text_preview.rs:71-79 | engine/crates/engine/src/text_preview.rs:83-91 — 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) android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt:344 — android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt:344-352 | android/app/src/main/java/com/chethan616/clearpdf/ui/onboarding/Onboarding.kt:355-363 — 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) engine/crates/cos/src/writer.rs:489 — engine/crates/cos/src/writer.rs:489-497 | engine/crates/organize/src/dedupe.rs:179-187 — 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) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:391 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:391-406 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt:302-310 — 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) engine/crates/render/src/text.rs:909 — engine/crates/render/src/text.rs:909-917 | engine/crates/render/src/text.rs:949-957 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×6
  • Edited copy of a member (12 corresponding lines) engine/crates/cos/src/writer.rs:651 — engine/crates/cos/src/writer.rs:651-662 | engine/crates/js/src/formcalc.rs:1874-1889 — 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) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:341 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:341-352 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:355-366 — 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) engine/crates/js/src/formcalc.rs:477 — engine/crates/js/src/formcalc.rs:477-488 | engine/crates/js/src/formcalc.rs:490-501 — 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) engine/crates/create/src/office/docx.rs:1476 — engine/crates/create/src/office/docx.rs:1476-1487 | engine/crates/create/src/office/docx.rs:1489-1500 — 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) engine/crates/export/src/xlsx.rs:95 — engine/crates/export/src/xlsx.rs:95-106 | engine/mobile/src/xls_art.rs:81-92 — 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) engine/crates/js/src/lib.rs:249 — engine/crates/js/src/lib.rs:249-260 | engine/crates/js/src/xfa.rs:314-325 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×6
  • Edited copy of a member (8 corresponding lines) engine/crates/annot/src/appearance.rs:331 — engine/crates/annot/src/appearance.rs:331-340 | engine/crates/forms/src/appearance.rs:387-394 — 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) engine/crates/engine/src/export.rs:87 — engine/crates/engine/src/export.rs:87-94 | engine/crates/engine/src/export.rs:97-104 — 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) android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt:353 — android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt:353-362 | android/app/src/main/java/com/chethan616/clearpdf/widget/WidgetCards.kt:295-302 — 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) engine/crates/xfa/src/layout.rs:1128 — engine/crates/xfa/src/layout.rs:1128-1135 | engine/crates/xfa/src/layout.rs:1139-1151 — 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) engine/crates/measure/src/lib.rs:626 — engine/crates/measure/src/lib.rs:626-634 | engine/crates/measure/src/lib.rs:635-642 — 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) engine/crates/cos/src/document.rs:1175 — engine/crates/cos/src/document.rs:1175-1182 | engine/crates/cos/src/document.rs:1233-1240 — 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.
IC1 · Incompleteness & stubs · Unfinished branch · ×6
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/measure/src/lib.rs:187 — `read` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/measure/src/lib.rs:197 — `read` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/measure/src/lib.rs:210 — `read` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/sign/src/pdf.rs:2239 — `sign_inner` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/sign/src/pdf.rs:2295 — `timestamp_document` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
  • Unfinished branch — a todo!() / unimplemented!() arm in a real function engine/crates/sign/src/pdf.rs:2307 — `locate` does real work, but one of its branches is `Err` with a "not implemented" message — a case that was never written, and a panic the first time it is reached. Implement the case, or return an error that says why it is not handled.
D1 · Cyclomatic Complexity · Document · ×5
  • Document::read_compact_section (cyclomatic 49) engine/crates/cos/src/document.rs:1632 — Document::read_compact_section has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Document::read_section (cyclomatic 31) engine/crates/cos/src/document.rs:1940 — Document::read_section has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Document::read_compact_xref_chain (cyclomatic 26) engine/crates/cos/src/document.rs:1529 — Document::read_compact_xref_chain has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Document::read_xref_chain_materialized (cyclomatic 23) engine/crates/cos/src/document.rs:1828 — Document::read_xref_chain_materialized 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.
  • Document::reconstruct (cyclomatic 23) engine/crates/cos/src/document.rs:2120 — Document::reconstruct 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 · Layouter · ×5
  • Layouter::draw_field (cyclomatic 46) engine/crates/xfa/src/layout.rs:1836 — Layouter::draw_field has cyclomatic complexity 46 (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.
  • Layouter::draw_node (cyclomatic 25) engine/crates/xfa/src/layout.rs:1546 — Layouter::draw_node has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Layouter::split_block (cyclomatic 22) engine/crates/xfa/src/layout.rs:897 — Layouter::split_block has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Layouter::flow_subform (cyclomatic 17) engine/crates/xfa/src/layout.rs:993 — Layouter::flow_subform 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.
  • Layouter::measure (cyclomatic 17) engine/crates/xfa/src/layout.rs:1189 — Layouter::measure has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · pdfcraft_preflight · ×5
  • pdfcraft_preflight::verify (cognitive 114) engine/crates/preflight/src/lib.rs:429 — pdfcraft_preflight::verify has cognitive complexity 114 (threshold 15). Drivers by points: if/else 30 (73 pts), boolean chains 20, match/switch 6 (13 pts), loops 5 (8 pts) (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_preflight::convert (cognitive 65) engine/crates/preflight/src/lib.rs:731 — pdfcraft_preflight::convert has cognitive complexity 65 (threshold 15). Drivers by points: if/else 23 (46 pts), boolean chains 12, loops 5 (7 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_preflight::xmp::xml_limits_ok (cognitive 38) engine/crates/preflight/src/xmp.rs:53 — pdfcraft_preflight::xmp::xml_limits_ok has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_preflight::content_colour (cognitive 20) engine/crates/preflight/src/lib.rs:349 — pdfcraft_preflight::content_colour has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_preflight::uses_device_colour (cognitive 18) engine/crates/preflight/src/lib.rs:385 — pdfcraft_preflight::uses_device_colour has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Planner · ×5
  • Planner::walk (cognitive 40) engine/crates/edit/src/inline_forms.rs:654 — Planner::walk has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 2 (7 pts), boolean chains 5, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Planner::merge (cognitive 32) engine/crates/edit/src/inline_forms.rs:456 — Planner::merge has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (5 pts), match/switch 1 (3 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.
  • Planner::covers (cognitive 24) engine/crates/edit/src/inline_forms.rs:406 — Planner::covers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Planner::draws_text (cognitive 20) engine/crates/edit/src/inline_forms.rs:318 — Planner::draws_text has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Planner::inline (cognitive 17) engine/crates/edit/src/inline_forms.rs:726 — Planner::inline has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 4, loops 1, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×5
  • Duplicated block (10 lines × 2) engine/crates/automation/src/tools.rs:1064 — engine/crates/automation/src/tools.rs:1064-1073 | engine/crates/automation/src/tools.rs:1081-1090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/automation/src/tools.rs:1064` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) engine/crates/forms/src/author.rs:1346 — engine/crates/forms/src/author.rs:1346-1355 | engine/crates/xfa/src/pdf.rs:415-424 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/forms/src/author.rs:1346` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) engine/crates/redact/src/tags.rs:215 — engine/crates/redact/src/tags.rs:215-224 | engine/crates/redact/src/tags.rs:490-499 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/redact/src/tags.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 (10 lines × 2) engine/crates/engine/src/lib.rs:4909 — engine/crates/engine/src/lib.rs:4909-4918 | engine/crates/engine/src/lib.rs:4961-4970 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/engine/src/lib.rs:4909` 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, `engine/crates/engine/src/lib.rs:4960` calls `Some`, `get`, `Err` and `engine/crates/engine/src/lib.rs:4908` 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) engine/crates/sign/src/pdf.rs:1092 — engine/crates/sign/src/pdf.rs:1092-1101 | engine/crates/sign/src/pdf.rs:1107-1116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/sign/src/pdf.rs:1092` 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.
D1 · Cyclomatic Complexity · pdfcraft_export · ×4
  • pdfcraft_export::tables (cyclomatic 41) engine/crates/export/src/lib.rs:196 — pdfcraft_export::tables has cyclomatic complexity 41 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • pdfcraft_export::docx (cyclomatic 20) engine/crates/export/src/lib.rs:763 — pdfcraft_export::docx has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_export::rtf (cyclomatic 20) engine/crates/export/src/lib.rs:912 — pdfcraft_export::rtf has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_export::xlsx::plain_number (cyclomatic 18) engine/crates/export/src/xlsx.rs:31 — pdfcraft_export::xlsx::plain_number 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 · Inspector · ×4
  • Inspector::page_labels (cyclomatic 38) engine/crates/render/src/inspect.rs:1294 — Inspector::page_labels has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Inspector::annotations (cyclomatic 32) engine/crates/render/src/inspect.rs:1430 — Inspector::annotations has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Inspector::fill (cyclomatic 29) engine/crates/render/src/inspect.rs:830 — Inspector::fill has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Inspector::field (cyclomatic 25) engine/crates/render/src/inspect.rs:1719 — Inspector::field has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · pdfcraft_xfdf · ×4
  • pdfcraft_xfdf::xfdf_annots (cyclomatic 34) engine/crates/xfdf/src/lib.rs:287 — pdfcraft_xfdf::xfdf_annots has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfdf::annot_from_xml (cyclomatic 27) engine/crates/xfdf/src/lib.rs:921 — pdfcraft_xfdf::annot_from_xml has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfdf::export_fdf (cyclomatic 24) engine/crates/xfdf/src/lib.rs:693 — pdfcraft_xfdf::export_fdf has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_xfdf::xml_nesting_depth (cyclomatic 16) engine/crates/xfdf/src/lib.rs:97 — pdfcraft_xfdf::xml_nesting_depth 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 · Planner · ×4
  • Planner::covers (cyclomatic 24) engine/crates/edit/src/inline_forms.rs:406 — Planner::covers has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • Planner::walk (cyclomatic 24) engine/crates/edit/src/inline_forms.rs:654 — Planner::walk has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Planner::inline (cyclomatic 18) engine/crates/edit/src/inline_forms.rs:726 — Planner::inline 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.
  • Planner::merge (cyclomatic 16) engine/crates/edit/src/inline_forms.rs:456 — Planner::merge 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 · pdfcraft_fonts · ×4
  • pdfcraft_fonts::pdf::unicode_map (cyclomatic 21) engine/crates/fonts/src/pdf.rs:1232 — pdfcraft_fonts::pdf::unicode_map has cyclomatic complexity 21 (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.
  • pdfcraft_fonts::embedding::embed_mapping (cyclomatic 20) engine/crates/fonts/src/embedding.rs:121 — pdfcraft_fonts::embedding::embed_mapping has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_fonts::pdf::parse_to_unicode_within (cyclomatic 20) engine/crates/fonts/src/pdf.rs:1119 — pdfcraft_fonts::pdf::parse_to_unicode_within has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_fonts::pdf::embedded_sfnt_within (cyclomatic 17) engine/crates/fonts/src/pdf.rs:103 — pdfcraft_fonts::pdf::embedded_sfnt_within 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.
D2 · Cognitive Complexity · Walker · ×4
  • Walker::ops (cognitive 103) engine/crates/measure/src/snap.rs:250 — Walker::ops has cognitive complexity 103 (threshold 15). Drivers by points: if/else 23 (83 pts), loops 3 (9 pts), match/switch 2 (6 pts), boolean chains 5 (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Walker::walk_ops (cognitive 56) engine/crates/audit/src/cover.rs:129 — Walker::walk_ops has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (35 pts), match/switch 5 (13 pts), boolean chains 7, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Walker::children (cognitive 24) engine/crates/xfa/src/script.rs:295 — Walker::children has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts), match/switch 2 (5 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.
  • Walker::walk (cognitive 19) engine/crates/measure/src/snap.rs:200 — Walker::walk has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Renderer · ×4
  • Renderer::graphic_frame (cognitive 80) engine/crates/create/src/office/pptx.rs:1228 — Renderer::graphic_frame has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (54 pts), loops 7 (14 pts), boolean chains 6, match/switch 2 (6 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Renderer::text_body (cognitive 65) engine/crates/create/src/office/pptx.rs:1014 — Renderer::text_body has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (42 pts), match/switch 7 (13 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Renderer::tree (cognitive 21) engine/crates/create/src/office/pptx.rs:861 — Renderer::tree has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Renderer::shape_inner (cognitive 21) engine/crates/create/src/office/pptx.rs:926 — Renderer::shape_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, match/switch 3, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · pdfcraft_cos · ×4
  • pdfcraft_cos::writer::write_full (cognitive 46) engine/crates/cos/src/writer.rs:270 — pdfcraft_cos::writer::write_full has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (34 pts), loops 8, boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_cos::parser::parse_indirect_in (cognitive 21) engine/crates/cos/src/parser.rs:439 — pdfcraft_cos::parser::parse_indirect_in has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 5 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_cos::writer::write_incremental (cognitive 18) engine/crates/cos/src/writer.rs:199 — pdfcraft_cos::writer::write_incremental has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • pdfcraft_cos::security::walk (cognitive 16) engine/crates/cos/src/security.rs:164 — pdfcraft_cos::security::walk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×4
  • Members sharing a duplicated core (4 members, 50+ identical tokens) engine/crates/a11y/src/headings.rs:181 — engine/crates/a11y/src/headings.rs:181-309 | engine/crates/edit/src/inline_forms.rs:662-723 | engine/crates/edit/src/text.rs:1208-1587 | engine/crates/redact/src/interp.rs:801-1096 — 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) engine/crates/annot/src/lib.rs:734 — engine/crates/annot/src/lib.rs:734-766 | engine/crates/forms/src/lib.rs:499-523 | engine/crates/model/src/lib.rs:160-213 | engine/crates/organize/src/lib.rs:104-144 — 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) engine/crates/audit/src/cover.rs:316 — engine/crates/audit/src/cover.rs:316-339 | engine/crates/edit/src/text.rs:772-793 | engine/crates/edit/src/text.rs:2080-2131 | engine/crates/redact/src/lib.rs:250-269 — 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) engine/crates/automation/src/forms.rs:588 — engine/crates/automation/src/forms.rs:588-615 | engine/crates/automation/src/lib.rs:1401-1484 | engine/crates/automation/src/lib.rs:1610-1660 | engine/crates/automation/src/lib.rs:1662-1699 — 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 (20 corresponding lines) · ×4
  • Edited copy of a member (20 corresponding lines) engine/crates/organize/src/import.rs:591 — engine/crates/organize/src/import.rs:591-610 | engine/crates/organize/src/import.rs:613-633 — 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) engine/crates/a11y/src/headings.rs:106 — engine/crates/a11y/src/headings.rs:106-126 | engine/crates/a11y/src/tags.rs:209-228 — 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) engine/crates/edit/src/indic.rs:122 — engine/crates/edit/src/indic.rs:122-141 | engine/crates/edit/src/indic.rs:145-167 — 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) engine/crates/create/src/office/zip.rs:174 — engine/crates/create/src/office/zip.rs:174-195 | engine/crates/forms/src/lib.rs:241-260 — 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 (11 corresponding lines) · ×4
  • Edited copy of a member (11 corresponding lines) engine/crates/render/src/inspect.rs:231 — engine/crates/render/src/inspect.rs:231-241 | engine/crates/render/src/inspect.rs:244-254 — 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) engine/crates/sign/src/keychain.rs:45 — engine/crates/sign/src/keychain.rs:45-55 | engine/crates/sign/src/windows.rs:74-85 — 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) engine/crates/engine/src/lib.rs:5112 — engine/crates/engine/src/lib.rs:5112-5123 | engine/crates/engine/src/lib.rs:5187-5197 — 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) android/backdrop/src/main/java/com/kyant/backdrop/effects/ColorFilter.kt:20 — android/backdrop/src/main/java/com/kyant/backdrop/effects/ColorFilter.kt:20-30 | android/backdrop/src/main/java/com/kyant/backdrop/effects/RenderEffect.kt:15-25 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 3+ corresponding lines) engine/crates/annot/src/lib.rs:967 — engine/crates/annot/src/lib.rs:967-969 | engine/crates/edit/src/added.rs:238-240 | engine/crates/edit/src/text.rs:683-685 — 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) engine/crates/a11y/src/tags.rs:150 — engine/crates/a11y/src/tags.rs:150-152 | engine/crates/cos/src/security.rs:14-16 | engine/crates/xfa/src/data.rs:289-291 — 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) engine/crates/edit/src/added.rs:362 — engine/crates/edit/src/added.rs:362-364 | engine/crates/edit/src/bidi.rs:28-30 | engine/crates/edit/src/text.rs:2296-2298 — 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) engine/crates/a11y/src/report.rs:10 — engine/crates/a11y/src/report.rs:10-12 | engine/crates/automation/src/a11y.rs:137-139 | engine/crates/preflight/src/xmp.rs:147-149 — 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 · Duplicated block (14 lines × 2) · ×4
  • Duplicated block (14 lines × 2) engine/crates/edit/src/text.rs:1279 — engine/crates/edit/src/text.rs:1279-1292 | engine/crates/redact/src/interp.rs:927-940 — 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 `engine/crates/edit/src/text.rs:1279` it does not close everything it opens, so those exact lines 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) engine/crates/forms/src/lib.rs:501 — engine/crates/forms/src/lib.rs:501-514 | engine/crates/organize/src/lib.rs:106-119 — before extracting anything, compare `engine/crates/forms/src/lib.rs` and `engine/crates/organize/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) engine/crates/cos/src/document.rs:1729 — engine/crates/cos/src/document.rs:1729-1742 | engine/crates/cos/src/document.rs:2000-2013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:110 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:110-123 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:190-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×4
  • Duplicated block (12 lines × 2) engine/crates/a11y/src/alt.rs:251 — engine/crates/a11y/src/alt.rs:251-262 | engine/crates/optimize/src/images.rs:66-77 — 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 `engine/crates/a11y/src/alt.rs:251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) engine/crates/forms/src/lib.rs:655 — engine/crates/forms/src/lib.rs:655-666 | engine/crates/render/src/inspect.rs:1824-1835 — 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 `engine/crates/forms/src/lib.rs:655` 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 `seen` to `&std::collections::HashSet<ObjRef>` in one and `&HashSet<ObjectId>` 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) engine/crates/js/src/formcalc.rs:1520 — engine/crates/js/src/formcalc.rs:1520-1531 | engine/crates/js/src/formcalc.rs:1536-1547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/js/src/formcalc.rs:1520` 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) engine/crates/render/src/inspect.rs:673 — engine/crates/render/src/inspect.rs:673-684 | engine/crates/render/src/inspect.rs:697-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/render/src/inspect.rs:673` 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.
D1 · Cyclomatic Complexity · pdfcraft_preflight · ×3
  • pdfcraft_preflight::verify (cyclomatic 64) engine/crates/preflight/src/lib.rs:429 — pdfcraft_preflight::verify has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_preflight::convert (cyclomatic 41) engine/crates/preflight/src/lib.rs:731 — pdfcraft_preflight::convert has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_preflight::xmp::xml_limits_ok (cyclomatic 20) engine/crates/preflight/src/xmp.rs:53 — pdfcraft_preflight::xmp::xml_limits_ok has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pdfcraft_print · ×3
  • pdfcraft_print::layout (cyclomatic 64) engine/crates/print/src/lib.rs:496 — pdfcraft_print::layout has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_print::spool::localize (cyclomatic 18) engine/crates/print/src/spool.rs:183 — pdfcraft_print::spool::localize has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_print::page_form (cyclomatic 16) engine/crates/print/src/lib.rs:855 — pdfcraft_print::page_form has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_print::cups_media (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Converter · ×3
  • Converter::table (cyclomatic 51) engine/crates/create/src/office/docx.rs:1283 — Converter::table has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Converter::run (cyclomatic 29) engine/crates/create/src/office/docx.rs:1124 — Converter::run has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Converter::paragraph (cyclomatic 16) engine/crates/create/src/office/docx.rs:968 — Converter::paragraph has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: pdfcraft_create::office::docx::highlight_colour (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Session · ×3
  • Session::apply (cyclomatic 45) engine/crates/engine/src/lib.rs:3960 — Session::apply has cyclomatic complexity 45 (threshold 15). Of this number, 42 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Session::prepare_open_unguarded (cyclomatic 28) engine/crates/engine/src/lib.rs:3681 — Session::prepare_open_unguarded has cyclomatic complexity 28 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Session::refresh_scoped (cyclomatic 23) engine/crates/engine/src/lib.rs:4242 — Session::refresh_scoped has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: pdfcraft_engine::add_annotation (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Renderer · ×3
  • Renderer::text_body (cyclomatic 35) engine/crates/create/src/office/pptx.rs:1014 — Renderer::text_body has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Renderer::graphic_frame (cyclomatic 35) engine/crates/create/src/office/pptx.rs:1228 — Renderer::graphic_frame has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Renderer::shape_inner (cyclomatic 20) engine/crates/create/src/office/pptx.rs:926 — Renderer::shape_inner has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Parser · ×3
  • Parser::statement (cyclomatic 33) engine/crates/js/src/formcalc.rs:325 — Parser::statement has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::postfix (cyclomatic 18) engine/crates/js/src/formcalc.rs:576 — Parser::postfix has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Parser::string (cyclomatic 16) engine/crates/forms/src/af.rs:185 — Parser::string has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · pdfcraft_cos · ×3
  • pdfcraft_cos::writer::write_full (cyclomatic 31) engine/crates/cos/src/writer.rs:270 — pdfcraft_cos::writer::write_full has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pdfcraft_cos::parser::parse_indirect_in (cyclomatic 17) engine/crates/cos/src/parser.rs:439 — pdfcraft_cos::parser::parse_indirect_in has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pdfcraft_cos::security::walk (cyclomatic 16) engine/crates/cos/src/security.rs:164 — pdfcraft_cos::security::walk has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Lexer · ×3
  • Lexer::next (cyclomatic 27) engine/crates/fonts/src/pdf.rs:454 — Lexer::next has cyclomatic complexity 27 (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.
  • Lexer::literal_string (cyclomatic 21) engine/crates/cos/src/parser.rs:189 — Lexer::literal_string has cyclomatic complexity 21 (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.
  • Lexer::object_depth (cyclomatic 20) engine/crates/cos/src/parser.rs:100 — Lexer::object_depth has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · SheetBook · ×3
  • SheetBook::cells (cognitive 97) engine/mobile/src/sheets.rs:326 — SheetBook::cells has cognitive complexity 97 (threshold 15). Drivers by points: if/else 23 (64 pts), match/switch 7 (18 pts), loops 3 (8 pts), boolean chains 7 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SheetBook::render_page (cognitive 27) engine/mobile/src/sheets.rs:651 — SheetBook::render_page has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • SheetBook::find (cognitive 18) engine/mobile/src/sheets.rs:562 — SheetBook::find has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session · ×3
  • Session::apply (cognitive 57) engine/crates/engine/src/lib.rs:3960 — Session::apply has cognitive complexity 57 (threshold 15). Drivers by points: if/else 30 (41 pts), boolean chains 12, match/switch 3 (4 pts) (nesting depth added 12). Of this number, 55 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Session::prepare_open_unguarded (cognitive 50) engine/crates/engine/src/lib.rs:3681 — Session::prepare_open_unguarded has cognitive complexity 50 (threshold 15). Drivers by points: match/switch 14 (27 pts), if/else 9 (18 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 24). 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.
  • Session::refresh_scoped (cognitive 28) engine/crates/engine/src/lib.rs:4242 — Session::refresh_scoped has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3 (6 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Parser · ×3
  • Parser::statement (cognitive 53) engine/crates/js/src/formcalc.rs:325 — Parser::statement has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (44 pts), loops 3 (8 pts), match/switch 1 (nesting depth added 27). 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.
  • Parser::postfix (cognitive 39) engine/crates/js/src/formcalc.rs:576 — Parser::postfix has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), match/switch 2 (6 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Parser::string (cognitive 18) engine/crates/forms/src/af.rs:185 — Parser::string has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_content · ×3
  • pdfcraft_content::unfiltered_image_end (cognitive 30) engine/crates/content/src/lib.rs:410 — pdfcraft_content::unfiltered_image_end has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 5 (9 pts), boolean chains 6, 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.
  • pdfcraft_content::comment_edges (cognitive 22) engine/crates/content/src/lib.rs:257 — pdfcraft_content::comment_edges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_content::inline_image (cognitive 16) engine/crates/content/src/lib.rs:306 — pdfcraft_content::inline_image has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (3 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · Pruner · ×3
  • Pruner::content (cognitive 30) engine/crates/organize/src/prune.rs:182 — Pruner::content has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 5 (15 pts), if/else 8 (14 pts), loops 1 (nesting depth added 16). 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.
  • Pruner::protect_type3_resources (cognitive 23) engine/crates/organize/src/prune.rs:128 — Pruner::protect_type3_resources has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Pruner::protect_glyph_tree (cognitive 17) engine/crates/organize/src/prune.rs:79 — Pruner::protect_glyph_tree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Styles · ×3
  • Styles::para (cognitive 28) engine/crates/create/src/office/docx.rs:356 — Styles::para has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Styles::parse (cognitive 17) engine/crates/create/src/office/docx.rs:296 — Styles::parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Styles::xml (cognitive 16) engine/crates/export/src/xlsx.rs:181 — Styles::xml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×3
  • Edited copy of a member (18 corresponding lines) engine/crates/forms/src/actions.rs:140 — engine/crates/forms/src/actions.rs:140-160 | engine/crates/forms/src/actions.rs:197-214 — 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) engine/crates/xfa/src/data.rs:496 — engine/crates/xfa/src/data.rs:496-513 | engine/crates/xfdf/src/lib.rs:194-213 — 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) engine/crates/xfa/src/fixtures.rs:128 — engine/crates/xfa/src/fixtures.rs:128-145 | engine/crates/xfa/src/fixtures.rs:647-675 — 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 (14 corresponding lines) · ×3
  • Edited copy of a member (14 corresponding lines) engine/crates/render/src/inspect.rs:2230 — engine/crates/render/src/inspect.rs:2230-2243 | engine/crates/xfa/src/packets.rs:84-98 — 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) engine/crates/sign/src/pdf.rs:165 — engine/crates/sign/src/pdf.rs:165-178 | engine/crates/sign/src/pdf.rs:180-193 — 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) engine/crates/js/src/formcalc.rs:528 — engine/crates/js/src/formcalc.rs:528-541 | engine/crates/js/src/formcalc.rs:543-556 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×3
  • Edited copy of a member (15 corresponding lines) engine/crates/forms/src/author.rs:550 — engine/crates/forms/src/author.rs:550-565 | engine/crates/organize/src/import.rs:879-893 — 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) android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt:97 — android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt:97-111 | android/app/src/main/java/com/chethan616/clearpdf/ui/home/Cards.kt:411-425 — 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) android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightStyle.kt:80 — android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightStyle.kt:80-95 | android/backdrop/src/main/java/com/kyant/backdrop/highlight/HighlightStyle.kt:111-125 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 4+ corresponding lines) engine/crates/model/src/lib.rs:21 — engine/crates/model/src/lib.rs:21-25 | engine/crates/organize/src/boxes.rs:54-58 | engine/crates/redact/src/lib.rs:152-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) engine/crates/annot/src/lib.rs:725 — engine/crates/annot/src/lib.rs:725-728 | engine/crates/forms/src/lib.rs:490-493 | engine/crates/organize/src/lib.rs:95-98 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) engine/crates/a11y/src/lib.rs:35 — engine/crates/a11y/src/lib.rs:35-38 | engine/crates/export/src/lib.rs:117-120 | engine/crates/optimize/src/images.rs:256-259 — 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 (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) engine/crates/automation/src/forms.rs:589 — engine/crates/automation/src/forms.rs:589-593 | engine/crates/automation/src/lib.rs:1403-1407 | engine/crates/automation/src/lib.rs:1612-1616 — 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 `self` to `crate) fn form_tab_order(&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 (5 lines × 3) engine/crates/render/src/inspect.rs:1738 — engine/crates/render/src/inspect.rs:1738-1742 | engine/crates/xfa/src/data.rs:1858-1862 | engine/crates/xfa/src/script.rs:553-557 — 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 (5 lines × 3) engine/crates/engine/src/lib.rs:4262 — engine/crates/engine/src/lib.rs:4262-4266 | engine/crates/engine/src/lib.rs:4365-4369 | engine/crates/engine/src/lib.rs:4429-4433 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `engine/crates/engine/src/lib.rs:4426` calls `release_working`, `sync_xfa_state`, `Some` and `engine/crates/engine/src/lib.rs:4261` 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 (13 lines × 2) · ×3
  • Duplicated block (13 lines × 2) engine/crates/create/src/office/pptx.rs:489 — engine/crates/create/src/office/pptx.rs:489-501 | engine/crates/create/src/office/pptx.rs:502-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/create/src/office/pptx.rs:489` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:214 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:214-226 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:206-218 — 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 `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:214` it does not close everything it opens, so those 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, `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:204` calls `Animatable` and `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:204` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:434 — android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:434-446 | android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:471-483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:434` 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.
X5 · Nullable reference types · Symbol treated as nullable, then dereferenced unguarded · ×3
  • Symbol treated as nullable, then dereferenced unguarded engine/crates/sign/src/der.rs:446 — `a.parse()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `oid` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded engine/crates/filters/src/flate.rs:79 — `e.write_all(data)` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `encode` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
  • Symbol treated as nullable, then dereferenced unguarded engine/crates/filters/src/flate.rs:80 — `e.finish()` can be absent — it is an `Option` or `Result`, which is why it is forced — and `.expect()` in `encode` forces it with nothing on this path excluding `None`/`Err`: no `if let` or `match` arm that matched it present, no `let … else`, no `is_some()`/`is_ok()` test (or `is_none()`/`is_err()` test that leaves), no `assert!` of it, and for a lookup no proof the key or index exists. This line panics the first time the value is not there. Handle the absent case where it arises: propagate it with `?`, branch on it with `if let` / `match` / `let … else`, or give it a default (`unwrap_or`, `unwrap_or_default`, `unwrap_or_else`).
D1 · Cyclomatic Complexity · Emitter · ×2
  • Emitter::widget (cyclomatic 58) engine/crates/xfa/src/pdf.rs:331 — Emitter::widget 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.
  • Emitter::page (cyclomatic 19) engine/crates/xfa/src/pdf.rs:670 — Emitter::page 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 · Walker · ×2
  • Walker::ops (cyclomatic 44) engine/crates/measure/src/snap.rs:250 — Walker::ops has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Walker::walk_ops (cyclomatic 40) engine/crates/audit/src/cover.rs:129 — Walker::walk_ops has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Runner · ×2
  • Runner::apply_effects (cyclomatic 25) engine/crates/engine/src/xfa.rs:562 — Runner::apply_effects has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Runner::set_value (cyclomatic 17) engine/crates/engine/src/xfa.rs:414 — Runner::set_value 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 · TextDevice · ×2
  • TextDevice::finish (cyclomatic 25) engine/crates/render/src/text.rs:519 — TextDevice::finish has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextDevice::draw_glyph (cyclomatic 25) engine/crates/render/src/text.rs:621 — TextDevice::draw_glyph has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pdfcraft_compare · ×2
  • pdfcraft_compare::myers (cyclomatic 21) engine/crates/compare/src/lib.rs:159 — pdfcraft_compare::myers 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.
  • pdfcraft_compare::visual_regions (cyclomatic 17) engine/crates/compare/src/lib.rs:404 — pdfcraft_compare::visual_regions 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.
D2 · Cognitive Complexity · Emitter · ×2
  • Emitter::widget (cognitive 85) engine/crates/xfa/src/pdf.rs:331 — Emitter::widget has cognitive complexity 85 (threshold 15). Drivers by points: if/else 47 (72 pts), match/switch 6 (11 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Emitter::page (cognitive 30) engine/crates/xfa/src/pdf.rs:670 — Emitter::page has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 2 (4 pts), loops 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.
D2 · Cognitive Complexity · TextDevice · ×2
  • TextDevice::finish (cognitive 54) engine/crates/render/src/text.rs:519 — TextDevice::finish has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (40 pts), loops 6 (9 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextDevice::draw_glyph (cognitive 31) engine/crates/render/src/text.rs:621 — TextDevice::draw_glyph has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 7, match/switch 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · pdfcraft_compare · ×2
  • pdfcraft_compare::visual_regions (cognitive 36) engine/crates/compare/src/lib.rs:404 — pdfcraft_compare::visual_regions has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 6 (13 pts), boolean chains 4 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_compare::myers (cognitive 35) engine/crates/compare/src/lib.rs:159 — pdfcraft_compare::myers has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (9 pts), boolean chains 8 (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 · Lexer · ×2
  • Lexer::next (cognitive 34) engine/crates/fonts/src/pdf.rs:454 — Lexer::next has cognitive complexity 34 (threshold 15). Drivers by points: loops 5 (11 pts), match/switch 4 (11 pts), if/else 5 (8 pts), boolean chains 4 (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.
  • Lexer::literal_string (cognitive 28) engine/crates/cos/src/parser.rs:189 — Lexer::literal_string has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (10 pts), loops 2 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Walk · ×2
  • Walk::content (cognitive 33) engine/crates/a11y/src/content.rs:71 — Walk::content has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (19 pts), match/switch 3 (9 pts), boolean chains 4, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Walk::content (cognitive 24) engine/crates/optimize/src/images.rs:60 — Walk::content has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 2 (5 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 · PageWalk · ×2
  • PageWalk::next (cognitive 31) engine/crates/organize/src/lib.rs:104 — PageWalk::next has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (6 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.
  • PageWalk::next (cognitive 17) engine/crates/annot/src/lib.rs:734 — PageWalk::next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_measure · ×2
  • pdfcraft_measure::list (cognitive 27) engine/crates/measure/src/lib.rs:481 — pdfcraft_measure::list has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (6 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.
  • pdfcraft_measure::validate_geometry (cognitive 19) engine/crates/measure/src/lib.rs:334 — pdfcraft_measure::validate_geometry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), boolean chains 1, match/switch 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 · Runner · ×2
  • Runner::apply_effects (cognitive 26) engine/crates/engine/src/xfa.rs:562 — Runner::apply_effects has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Runner::set_value (cognitive 22) engine/crates/engine/src/xfa.rs:414 — Runner::set_value has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Copier · ×2
  • Copier::fix_annotations (cognitive 25) engine/crates/organize/src/import.rs:188 — Copier::fix_annotations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 2 (8 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Copier::copy_dict (cognitive 18) engine/crates/organize/src/import.rs:134 — Copier::copy_dict has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · Scope · ×2
  • Scope::layer_hidden (cognitive 25) engine/crates/redact/src/interp.rs:155 — Scope::layer_hidden has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Scope::visibility_expression (cognitive 16) engine/crates/redact/src/interp.rs:284 — Scope::visibility_expression has cognitive complexity 16 (threshold 15). Drivers by points: loops 2 (6 pts), match/switch 3 (5 pts), if/else 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OcspResponse · ×2
  • OcspResponse::parse (cognitive 25) engine/crates/sign/src/revocation.rs:179 — OcspResponse::parse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (5 pts), match/switch 2 (3 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.
  • OcspResponse::check (cognitive 19) engine/crates/sign/src/revocation.rs:260 — OcspResponse::check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Checks · ×2
  • Checks::enter (cognitive 22) engine/crates/a11y/src/structure.rs:666 — Checks::enter has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Checks::exit (cognitive 19) engine/crates/a11y/src/structure.rs:733 — Checks::exit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 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 · pdfcraft_audit · ×2
  • pdfcraft_audit::audit (cognitive 22) engine/crates/audit/src/lib.rs:189 — pdfcraft_audit::audit has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 3 (10 pts), if/else 2 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 13). 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.
  • pdfcraft_audit::annots (cognitive 20) engine/crates/audit/src/lib.rs:321 — pdfcraft_audit::annots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 4 (7 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Numbering · ×2
  • Numbering::parse (cognitive 22) engine/crates/create/src/office/docx.rs:469 — Numbering::parse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (6 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.
  • Numbering::label (cognitive 20) engine/crates/create/src/office/docx.rs:512 — Numbering::label has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_filters · ×2
  • pdfcraft_filters::lzw::decode (cognitive 20) engine/crates/filters/src/lzw.rs:52 — pdfcraft_filters::lzw::decode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pdfcraft_filters::flate::inflate_raw (cognitive 16) engine/crates/filters/src/flate.rs:41 — pdfcraft_filters::flate::inflate_raw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, 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.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×2
  • Edited copy of a member (24 corresponding lines) engine/crates/render/src/inspect.rs:1122 — engine/crates/render/src/inspect.rs:1122-1145 | engine/crates/render/src/inspect.rs:1155-1182 — 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) engine/crates/xfa/src/layout.rs:362 — engine/crates/xfa/src/layout.rs:362-385 | engine/crates/xfa/src/parse.rs:694-717 — 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 (16 corresponding lines) · ×2
  • Edited copy of a member (16 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:538 — android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:538-553 | android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:557-572 — 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) engine/crates/create/src/office/draw.rs:54 — engine/crates/create/src/office/draw.rs:54-70 | engine/crates/create/src/office/draw.rs:72-87 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×2
  • Edited copy of a member (13 corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:665 — android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:665-678 | android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:2255-2267 — 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) engine/crates/a11y/src/alt.rs:65 — engine/crates/a11y/src/alt.rs:65-77 | engine/crates/a11y/src/structure.rs:414-426 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 12+ corresponding lines) engine/crates/engine/src/signature_image.rs:30 — engine/crates/engine/src/signature_image.rs:30-42 | engine/crates/engine/src/stamp_preview.rs:47-58 | engine/crates/engine/src/text_preview.rs:20-32 — 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.
  • Edited copies of one member (3 members, 12+ corresponding lines) engine/crates/edit/src/indic.rs:14 — engine/crates/edit/src/indic.rs:14-27 | engine/crates/fonts/src/lib.rs:74-89 | engine/crates/xfdf/src/lib.rs:815-826 — 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, 3+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 3+ corresponding lines) engine/crates/a11y/src/content.rs:66 — engine/crates/a11y/src/content.rs:66-68 | engine/crates/a11y/src/headings.rs:170-172 | engine/crates/optimize/src/audit.rs:122-124 | engine/crates/redact/src/interp.rs:391-393 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 3+ corresponding lines) engine/crates/annot/src/lib.rs:955 — engine/crates/annot/src/lib.rs:955-957 | engine/crates/forms/src/author.rs:113-115 | engine/crates/xfa/src/pdf.rs:108-110 | engine/crates/xfdf/src/lib.rs:280-282 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×2
  • Duplicated block (11 lines × 2) engine/crates/engine/src/lib.rs:4182 — engine/crates/engine/src/lib.rs:4182-4192 | engine/crates/engine/src/lib.rs:4211-4221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/engine/src/lib.rs:4182` 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) engine/crates/sign/src/der.rs:447 — engine/crates/sign/src/der.rs:447-457 | engine/crates/sign/src/der.rs:474-484 — both copies are in the same file, so extract the 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 (3–7 lines × 3) · ×2
  • Duplicated block (3–7 lines × 3) engine/crates/forms/src/author.rs:554 — engine/crates/forms/src/author.rs:554-560 | engine/crates/forms/src/author.rs:1691-1697 | engine/crates/sign/src/pdf.rs:2163-2165 — 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 `engine/crates/forms/src/author.rs:554` 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 (3–7 lines × 3) engine/crates/js/src/formcalc.rs:1751 — engine/crates/js/src/formcalc.rs:1751-1757 | engine/crates/js/src/formcalc.rs:1782-1784 | engine/crates/js/src/formcalc.rs:1800-1806 — 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 `engine/crates/js/src/formcalc.rs:1751` 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 (6 lines × 3) · ×2
  • Duplicated block (6 lines × 3) engine/crates/annot/src/lib.rs:736 — engine/crates/annot/src/lib.rs:736-741 | engine/crates/forms/src/lib.rs:501-506 | engine/crates/organize/src/lib.rs:106-111 — before extracting anything, compare `engine/crates/forms/src/lib.rs` and `engine/crates/organize/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) engine/crates/edit/src/flatten.rs:401 — engine/crates/edit/src/flatten.rs:401-406 | engine/crates/organize/src/import.rs:674-679 | engine/crates/xfa/src/script.rs:157-162 — 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 `engine/crates/edit/src/flatten.rs:401` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X18 · Disposal-pattern correctness · Raw handle taken from an owned value and never reclaimed · ×2
  • Raw handle taken from an owned value and never reclaimed engine/crates/engine/src/copy_image.rs:60 — `rgba.into_raw()` (line 60) gives up ownership in exchange for a raw handle — the value's `Drop` will no longer run — and nothing in the crate's code ever reclaims a `image` from a raw pointer (`image::from_raw`). The memory or descriptor stays allocated until the process ends, once per call. Pair the hand-out with its reclaim (a `free` function that rebuilds the owner with `from_raw` and drops it), or keep the owning value.
  • Raw handle taken from an owned value and never reclaimed engine/crates/create/src/extract.rs:477 — `img.into_raw()` (line 477) gives up ownership in exchange for a raw handle — the value's `Drop` will no longer run — and nothing in the crate's code ever reclaims a `image` from a raw pointer (`image::from_raw`). The memory or descriptor stays allocated until the process ends, once per call. Pair the hand-out with its reclaim (a `free` function that rebuilds the owner with `from_raw` and drops it), or keep the owning value.
D1 · Cyclomatic Complexity · PhotoEditorKt.PhotoEditScreen (cyclomatic 146) · ×1
  • PhotoEditorKt.PhotoEditScreen (cyclomatic 146) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:274 — PhotoEditorKt.PhotoEditScreen has cyclomatic complexity 146 (threshold 15). To reduce it, separate the cases: extract each independent 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 · Edit · ×1
  • Edit::label (cyclomatic 118) engine/crates/engine/src/lib.rs:2134 — Edit::label has cyclomatic complexity 118 (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 · ViewerScreenKt.ViewerScreen (cyclomatic 116) · ×1
  • ViewerScreenKt.ViewerScreen (cyclomatic 116) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:95 — ViewerScreenKt.ViewerScreen has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent 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 · SheetViewerKt.drawSheet (cyclomatic 105) · ×1
  • SheetViewerKt.drawSheet (cyclomatic 105) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1105 — SheetViewerKt.drawSheet has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MindMapKt.MindMapEditor (cyclomatic 75) · ×1
  • MindMapKt.MindMapEditor (cyclomatic 75) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:690 — MindMapKt.MindMapEditor has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent 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 · SheetViewerKt.SheetGrid (cyclomatic 53) · ×1
  • SheetViewerKt.SheetGrid (cyclomatic 53) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:431 — SheetViewerKt.SheetGrid has cyclomatic complexity 53 (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 · SheetViewerKt.SheetViewer (cyclomatic 49) · ×1
  • SheetViewerKt.SheetViewer (cyclomatic 49) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:673 — SheetViewerKt.SheetViewer has cyclomatic complexity 49 (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 · Writer · ×1
  • Writer::page (cyclomatic 46) engine/crates/create/src/office/draw.rs:439 — Writer::page has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SheetBook · ×1
  • SheetBook::cells (cyclomatic 46) engine/mobile/src/sheets.rs:326 — SheetBook::cells has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageCanvasKt.PageCanvas (cyclomatic 46) · ×1
  • PageCanvasKt.PageCanvas (cyclomatic 46) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt:80 — PageCanvasKt.PageCanvas has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClearAppKt.Shell (cyclomatic 44) · ×1
  • ClearAppKt.Shell (cyclomatic 44) android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt:139 — ClearAppKt.Shell has cyclomatic complexity 44 (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 · MascotKt.Mascot (cyclomatic 44) · ×1
  • MascotKt.Mascot (cyclomatic 44) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt:80 — MascotKt.Mascot has cyclomatic complexity 44 (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 · PagesScreenKt.PagesScreen (cyclomatic 44) · ×1
  • PagesScreenKt.PagesScreen (cyclomatic 44) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt:83 — PagesScreenKt.PagesScreen has cyclomatic complexity 44 (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 · FilesScreenKt.FilesScreen (cyclomatic 38) · ×1
  • FilesScreenKt.FilesScreen (cyclomatic 38) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt:82 — FilesScreenKt.FilesScreen has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolScreensKt.CropScreen (cyclomatic 37) · ×1
  • ToolScreensKt.CropScreen (cyclomatic 37) android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:632 — ToolScreensKt.CropScreen has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MindMapKt.layoutMind (cyclomatic 35) · ×1
  • MindMapKt.layoutMind (cyclomatic 35) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:394 — MindMapKt.layoutMind has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SheetChartsKt.paintChart (cyclomatic 34) · ×1
  • SheetChartsKt.paintChart (cyclomatic 34) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetCharts.kt:20 — SheetChartsKt.paintChart has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StyleSheet · ×1
  • StyleSheet::parse (cyclomatic 33) engine/crates/create/src/office/xlsx.rs:132 — StyleSheet::parse has cyclomatic complexity 33 (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 · ImageState · ×1
  • ImageState::apply (cyclomatic 33) engine/crates/edit/src/images.rs:131 — ImageState::apply has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Extensions · ×1
  • Extensions::read (cyclomatic 32) engine/crates/sign/src/x509.rs:195 — Extensions::read has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Metrics · ×1
  • Metrics::read_metrics (cyclomatic 30) engine/crates/fonts/src/pdf.rs:683 — Metrics::read_metrics has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommentPanelKt.CommentPanel (cyclomatic 30) · ×1
  • CommentPanelKt.CommentPanel (cyclomatic 30) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt:62 — CommentPanelKt.CommentPanel has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CreateDockKt.CreateDock (cyclomatic 29) · ×1
  • CreateDockKt.CreateDock (cyclomatic 29) android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt:177 — CreateDockKt.CreateDock has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MindMapKt.drawMind (cyclomatic 29) · ×1
  • MindMapKt.drawMind (cyclomatic 29) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:542 — MindMapKt.drawMind has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AudioExportKt.wavToM4a (cyclomatic 26) · ×1
  • AudioExportKt.wavToM4a (cyclomatic 26) android/app/src/main/java/com/chethan616/clearpdf/notes/AudioExport.kt:22 — AudioExportKt.wavToM4a has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pdfcraft_content · ×1
  • pdfcraft_content::unfiltered_image_end (cyclomatic 25) engine/crates/content/src/lib.rs:410 — pdfcraft_content::unfiltered_image_end has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Colours · ×1
  • Colours::of (cyclomatic 25) engine/crates/create/src/office/pptx.rs:79 — Colours::of has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LiquidMorphKt.LiquidMorphSurface (cyclomatic 25) · ×1
  • LiquidMorphKt.LiquidMorphSurface (cyclomatic 25) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:182 — LiquidMorphKt.LiquidMorphSurface has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · QuickPreviewKt.Preview (cyclomatic 24) · ×1
  • QuickPreviewKt.Preview (cyclomatic 24) android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt:138 — QuickPreviewKt.Preview has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Walk · ×1
  • Walk::content (cyclomatic 23) engine/crates/a11y/src/content.rs:71 — Walk::content 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 · MainActivity.collectRequests (cyclomatic 23) · ×1
  • MainActivity.collectRequests (cyclomatic 23) android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt:104 — MainActivity.collectRequests has cyclomatic complexity 23 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · PhotoMarksKt.paintMarks (cyclomatic 23) · ×1
  • PhotoMarksKt.paintMarks (cyclomatic 23) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:395 — PhotoMarksKt.paintMarks 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 · ReadingModeKt.ReadingModeContent (cyclomatic 23) · ×1
  • ReadingModeKt.ReadingModeContent (cyclomatic 23) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadingMode.kt:56 — ReadingModeKt.ReadingModeContent 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 · NoteEditorKt.NoteEditor (cyclomatic 22) · ×1
  • NoteEditorKt.NoteEditor (cyclomatic 22) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt:107 — NoteEditorKt.NoteEditor has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Checks · ×1
  • Checks::enter (cyclomatic 21) engine/crates/a11y/src/structure.rs:666 — Checks::enter 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 · Styles · ×1
  • Styles::para (cyclomatic 21) engine/crates/create/src/office/docx.rs:356 — Styles::para 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 · Scope · ×1
  • Scope::layer_hidden (cyclomatic 21) engine/crates/redact/src/interp.rs:155 — Scope::layer_hidden 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 · Thumbnails.ofContent (cyclomatic 21) · ×1
  • Thumbnails.ofContent (cyclomatic 21) android/app/src/main/java/com/chethan616/clearpdf/engine/LocalFiles.kt:210 — Thumbnails.ofContent has cyclomatic complexity 21 (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 · AppViewModel.viewerKey (cyclomatic 21) · ×1
  • AppViewModel.viewerKey (cyclomatic 21) android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:619 — AppViewModel.viewerKey has cyclomatic complexity 21 (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 · ToolScreensKt.ProtectScreen (cyclomatic 21) · ×1
  • ToolScreensKt.ProtectScreen (cyclomatic 21) android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:350 — ToolScreensKt.ProtectScreen has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ButtonsKt.glassControl (cyclomatic 21) · ×1
  • ButtonsKt.glassControl (cyclomatic 21) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:64 — ButtonsKt.glassControl has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommentListKt.CommentRow (cyclomatic 21) · ×1
  • CommentListKt.CommentRow (cyclomatic 21) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt:244 — CommentListKt.CommentRow has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DetectionPath · ×1
  • DetectionPath::rectangle (cyclomatic 20) engine/crates/forms/src/detect.rs:69 — DetectionPath::rectangle has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · OcspResponse · ×1
  • OcspResponse::parse (cyclomatic 20) engine/crates/sign/src/revocation.rs:179 — OcspResponse::parse has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppViewModel.enterTool (cyclomatic 20) · ×1
  • AppViewModel.enterTool (cyclomatic 20) android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:458 — AppViewModel.enterTool 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 · HomeScreenKt.HomeScreen (cyclomatic 20) · ×1
  • HomeScreenKt.HomeScreen (cyclomatic 20) android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt:164 — HomeScreenKt.HomeScreen has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MascotFaceKt.drawFace (cyclomatic 20) · ×1
  • MascotFaceKt.drawFace (cyclomatic 20) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt:130 — MascotFaceKt.drawFace has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SheetViewerKt.panZoomFling (cyclomatic 20) · ×1
  • SheetViewerKt.panZoomFling (cyclomatic 20) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1437 — SheetViewerKt.panZoomFling has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpServer · ×1
  • McpServer::dispatch (cyclomatic 19) engine/crates/automation/src/mcp.rs:148 — McpServer::dispatch has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Haptics.fallback (cyclomatic 19) · ×1
  • Haptics.fallback (cyclomatic 19) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.kt:115 — Haptics.fallback 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 · MorphButtonKt.RectMorphSurface (cyclomatic 19) · ×1
  • MorphButtonKt.RectMorphSurface (cyclomatic 19) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:178 — MorphButtonKt.RectMorphSurface has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MascotFaceKt.drawEye (cyclomatic 19) · ×1
  • MascotFaceKt.drawEye (cyclomatic 19) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt:233 — MascotFaceKt.drawEye has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommentListKt.commentActionLabel (cyclomatic 19) · ×1
  • CommentListKt.commentActionLabel (cyclomatic 19) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt:87 — CommentListKt.commentActionLabel has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Ops · ×1
  • Ops::next (cyclomatic 18) engine/crates/content/src/lib.rs:152 — Ops::next has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FieldTable · ×1
  • FieldTable::cells (cyclomatic 18) engine/crates/forms/src/table.rs:86 — FieldTable::cells has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PageTree · ×1
  • PageTree::next (cyclomatic 18) engine/crates/model/src/lib.rs:160 — PageTree::next has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DigitalSignKt.SignatureDetails (cyclomatic 18) · ×1
  • DigitalSignKt.SignatureDetails (cyclomatic 18) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:571 — DigitalSignKt.SignatureDetails has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ViewerBarsKt.ViewerTopBar (cyclomatic 18) · ×1
  • ViewerBarsKt.ViewerTopBar (cyclomatic 18) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt:108 — ViewerBarsKt.ViewerTopBar has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Discovery · ×1
  • Discovery::walk (cyclomatic 17) engine/crates/automation/src/batch.rs:143 — Discovery::walk 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 · PublicKey · ×1
  • PublicKey::verify_scheme (cyclomatic 17) engine/crates/sign/src/keys.rs:474 — PublicKey::verify_scheme 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 · OverlaysKt.GlassDialog (cyclomatic 17) · ×1
  • OverlaysKt.GlassDialog (cyclomatic 17) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt:103 — OverlaysKt.GlassDialog 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 · EditKt.InlineEditor (cyclomatic 17) · ×1
  • EditKt.InlineEditor (cyclomatic 17) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:518 — EditKt.InlineEditor has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FormsKt.FieldEditor (cyclomatic 17) · ×1
  • FormsKt.FieldEditor (cyclomatic 17) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt:72 — FormsKt.FieldEditor has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pdfcraft_automation · ×1
  • pdfcraft_automation::content::style (cyclomatic 16) engine/crates/automation/src/content.rs:34 — pdfcraft_automation::content::style has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ParaProps · ×1
  • ParaProps::merge (cyclomatic 16) engine/crates/create/src/office/docx.rs:75 — ParaProps::merge has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: pdfcraft_create::office::docx::highlight_colour (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Geometry · ×1
  • Geometry::snap (cyclomatic 16) engine/crates/measure/src/snap.rs:96 — Geometry::snap has cyclomatic complexity 16 (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.
D1 · Cyclomatic Complexity · PageText · ×1
  • PageText::column_text (cyclomatic 16) engine/crates/render/src/text.rs:307 — PageText::column_text has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SettingsScreenKt.WallpaperPicker (cyclomatic 16) · ×1
  • SettingsScreenKt.WallpaperPicker (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:430 — SettingsScreenKt.WallpaperPicker has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GlassLuminance.run (cyclomatic 16) · ×1
  • GlassLuminance.run (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt:72 — GlassLuminance.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.
D1 · Cyclomatic Complexity · TabsKt.GlassTabs (cyclomatic 16) · ×1
  • TabsKt.GlassTabs (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt:84 — TabsKt.GlassTabs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommentListKt.CommentListScreen (cyclomatic 16) · ×1
  • CommentListKt.CommentListScreen (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt:126 — CommentListKt.CommentListScreen has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReadAloud.skip (cyclomatic 16) · ×1
  • ReadAloud.skip (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:336 — ReadAloud.skip 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 · ShapeSnap.recognise (cyclomatic 16) · ×1
  • ShapeSnap.recognise (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ShapeSnap.kt:52 — ShapeSnap.recognise has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · VoiceSheetKt.VoiceSheet (cyclomatic 16) · ×1
  • VoiceSheetKt.VoiceSheet (cyclomatic 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.kt:64 — VoiceSheetKt.VoiceSheet has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment android/backdrop/src/main/java/com/kyant/backdrop/backdrops/LayerBackdrop.kt:67 — // TODO: outer transformations lead to wrong position calculation — 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 · PhotoEditorKt.PhotoEditScreen (cognitive 275) · ×1
  • PhotoEditorKt.PhotoEditScreen (cognitive 275) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:274 — PhotoEditorKt.PhotoEditScreen has cognitive complexity 275 (threshold 15). Drivers by points: if/else 114 (207 pts), boolean chains 36, loops 7 (17 pts), match/switch 8 (15 pts) (nesting depth added 110). To reduce it, split the body into named stages: move each independent 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 · SheetViewerKt.drawSheet (cognitive 182) · ×1
  • SheetViewerKt.drawSheet (cognitive 182) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1105 — SheetViewerKt.drawSheet has cognitive complexity 182 (threshold 15). Drivers by points: if/else 75 (118 pts), loops 15 (29 pts), boolean chains 24, match/switch 6 (11 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent 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 · ViewerScreenKt.ViewerScreen (cognitive 160) · ×1
  • ViewerScreenKt.ViewerScreen (cognitive 160) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:95 — ViewerScreenKt.ViewerScreen has cognitive complexity 160 (threshold 15). Drivers by points: if/else 95 (129 pts), boolean chains 27, match/switch 3 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MindMapKt.MindMapEditor (cognitive 129) · ×1
  • MindMapKt.MindMapEditor (cognitive 129) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:690 — MindMapKt.MindMapEditor has cognitive complexity 129 (threshold 15). Drivers by points: if/else 68 (111 pts), boolean chains 11, match/switch 5 (6 pts), loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageCanvasKt.PageCanvas (cognitive 88) · ×1
  • PageCanvasKt.PageCanvas (cognitive 88) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageCanvas.kt:80 — PageCanvasKt.PageCanvas has cognitive complexity 88 (threshold 15). Drivers by points: if/else 38 (73 pts), boolean chains 9, loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SheetViewerKt.SheetViewer (cognitive 85) · ×1
  • SheetViewerKt.SheetViewer (cognitive 85) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:673 — SheetViewerKt.SheetViewer has cognitive complexity 85 (threshold 15). Drivers by points: if/else 61 (78 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 18). 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 · SheetViewerKt.SheetGrid (cognitive 79) · ×1
  • SheetViewerKt.SheetGrid (cognitive 79) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:431 — SheetViewerKt.SheetGrid has cognitive complexity 79 (threshold 15). Drivers by points: if/else 42 (55 pts), boolean chains 11, match/switch 4 (7 pts), loops 4 (6 pts) (nesting depth added 18). 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 · Writer · ×1
  • Writer::page (cognitive 78) engine/crates/create/src/office/draw.rs:439 — Writer::page has cognitive complexity 78 (threshold 15). Drivers by points: if/else 24 (54 pts), match/switch 5 (12 pts), loops 5 (7 pts), boolean chains 5 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Metrics · ×1
  • Metrics::read_metrics (cognitive 74) engine/crates/fonts/src/pdf.rs:683 — Metrics::read_metrics has cognitive complexity 74 (threshold 15). Drivers by points: if/else 21 (55 pts), loops 2 (8 pts), boolean chains 7, match/switch 1 (4 pts) (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MindMapKt.drawMind (cognitive 73) · ×1
  • MindMapKt.drawMind (cognitive 73) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:542 — MindMapKt.drawMind has cognitive complexity 73 (threshold 15). Drivers by points: if/else 39 (66 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PagesScreenKt.PagesScreen (cognitive 71) · ×1
  • PagesScreenKt.PagesScreen (cognitive 71) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PagesScreen.kt:83 — PagesScreenKt.PagesScreen has cognitive complexity 71 (threshold 15). Drivers by points: if/else 42 (51 pts), boolean chains 13, match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 13). 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 · FilesScreenKt.FilesScreen (cognitive 70) · ×1
  • FilesScreenKt.FilesScreen (cognitive 70) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/FilesScreen.kt:82 — FilesScreenKt.FilesScreen has cognitive complexity 70 (threshold 15). Drivers by points: if/else 35 (51 pts), loops 4 (11 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Extensions · ×1
  • Extensions::read (cognitive 68) engine/crates/sign/src/x509.rs:195 — Extensions::read has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (49 pts), loops 6 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 43). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SheetChartsKt.paintChart (cognitive 68) · ×1
  • SheetChartsKt.paintChart (cognitive 68) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetCharts.kt:20 — SheetChartsKt.paintChart has cognitive complexity 68 (threshold 15). Drivers by points: if/else 26 (55 pts), match/switch 3 (8 pts), boolean chains 3, loops 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PhotoMarksKt.paintMarks (cognitive 67) · ×1
  • PhotoMarksKt.paintMarks (cognitive 67) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoMarks.kt:395 — PhotoMarksKt.paintMarks has cognitive complexity 67 (threshold 15). Drivers by points: if/else 18 (49 pts), loops 6 (15 pts), boolean chains 3 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MascotKt.Mascot (cognitive 65) · ×1
  • MascotKt.Mascot (cognitive 65) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/Mascot.kt:80 — MascotKt.Mascot has cognitive complexity 65 (threshold 15). Drivers by points: if/else 32 (36 pts), loops 7 (20 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 21). 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 · MindMapKt.layoutMind (cognitive 59) · ×1
  • MindMapKt.layoutMind (cognitive 59) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:394 — MindMapKt.layoutMind has cognitive complexity 59 (threshold 15). Drivers by points: if/else 34 (45 pts), loops 4 (7 pts), boolean chains 4, match/switch 3 (nesting depth added 14). 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 · AudioExportKt.wavToM4a (cognitive 49) · ×1
  • AudioExportKt.wavToM4a (cognitive 49) android/app/src/main/java/com/chethan616/clearpdf/notes/AudioExport.kt:22 — AudioExportKt.wavToM4a has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 5, loops 2, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommentPanelKt.CommentPanel (cognitive 48) · ×1
  • CommentPanelKt.CommentPanel (cognitive 48) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt:62 — CommentPanelKt.CommentPanel has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (36 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiquidMorphKt.LiquidMorphSurface (cognitive 46) · ×1
  • LiquidMorphKt.LiquidMorphSurface (cognitive 46) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:182 — LiquidMorphKt.LiquidMorphSurface has cognitive complexity 46 (threshold 15). Drivers by points: if/else 41 (44 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · StyleSheet · ×1
  • StyleSheet::parse (cognitive 43) engine/crates/create/src/office/xlsx.rs:132 — StyleSheet::parse has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (13 pts), match/switch 4 (13 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadAloud.skip (cognitive 43) · ×1
  • ReadAloud.skip (cognitive 43) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:336 — ReadAloud.skip has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (38 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ReadingModeKt.ReadingModeContent (cognitive 43) · ×1
  • ReadingModeKt.ReadingModeContent (cognitive 43) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadingMode.kt:56 — ReadingModeKt.ReadingModeContent has cognitive complexity 43 (threshold 15). Drivers by points: if/else 25 (37 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClearAppKt.Shell (cognitive 42) · ×1
  • ClearAppKt.Shell (cognitive 42) android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt:139 — ClearAppKt.Shell has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 14, match/switch 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SheetViewerKt.panZoomFling (cognitive 42) · ×1
  • SheetViewerKt.panZoomFling (cognitive 42) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:1437 — SheetViewerKt.panZoomFling has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (37 pts), boolean chains 4, loops 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CreateDockKt.CreateDock (cognitive 40) · ×1
  • CreateDockKt.CreateDock (cognitive 40) android/app/src/main/java/com/chethan616/clearpdf/ui/home/CreateDock.kt:177 — CreateDockKt.CreateDock has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27 (30 pts), boolean chains 8, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LocalFiles.scan (cognitive 39) · ×1
  • LocalFiles.scan (cognitive 39) android/app/src/main/java/com/chethan616/clearpdf/engine/LocalFiles.kt:63 — LocalFiles.scan has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PageTree · ×1
  • PageTree::next (cognitive 37) engine/crates/model/src/lib.rs:160 — PageTree::next has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (6 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MascotFaceKt.drawFace (cognitive 37) · ×1
  • MascotFaceKt.drawFace (cognitive 37) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt:130 — MascotFaceKt.drawFace has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22 (32 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NoteEditorKt.NoteEditor (cognitive 37) · ×1
  • NoteEditorKt.NoteEditor (cognitive 37) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/NoteEditor.kt:107 — NoteEditorKt.NoteEditor has cognitive complexity 37 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ViewerSheetsKt.BookmarksSheet (cognitive 35) · ×1
  • ViewerSheetsKt.BookmarksSheet (cognitive 35) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt:259 — ViewerSheetsKt.BookmarksSheet has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 1 (3 pts), match/switch 1 (2 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.
D2 · Cognitive Complexity · XrefSection · ×1
  • XrefSection::has_any_entry (cognitive 34) engine/crates/cos/src/document.rs:105 — XrefSection::has_any_entry has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 2 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ToolScreensKt.ProtectScreen (cognitive 34) · ×1
  • ToolScreensKt.ProtectScreen (cognitive 34) android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:350 — ToolScreensKt.ProtectScreen has cognitive complexity 34 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 5 (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 · FillSignKt.SignPanel (cognitive 34) · ×1
  • FillSignKt.SignPanel (cognitive 34) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt:152 — FillSignKt.SignPanel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (33 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolScreensKt.CropScreen (cognitive 33) · ×1
  • ToolScreensKt.CropScreen (cognitive 33) android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:632 — ToolScreensKt.CropScreen has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 6, loops 2, match/switch 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · OverlaysKt.GlassDialog (cognitive 33) · ×1
  • OverlaysKt.GlassDialog (cognitive 33) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Overlays.kt:103 — OverlaysKt.GlassDialog has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ImageState · ×1
  • ImageState::apply (cognitive 30) engine/crates/edit/src/images.rs:131 — ImageState::apply has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 7, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DigitalSignKt.SignatureDetails (cognitive 30) · ×1
  • DigitalSignKt.SignatureDetails (cognitive 30) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:571 — DigitalSignKt.SignatureDetails has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (22 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommentListKt.CommentRow (cognitive 29) · ×1
  • CommentListKt.CommentRow (cognitive 29) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt:244 — CommentListKt.CommentRow has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · EditKt.InlineEditor (cognitive 29) · ×1
  • EditKt.InlineEditor (cognitive 29) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:518 — EditKt.InlineEditor has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (22 pts), loops 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ViewerBarsKt.ViewerTopBar (cognitive 29) · ×1
  • ViewerBarsKt.ViewerTopBar (cognitive 29) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerBars.kt:108 — ViewerBarsKt.ViewerTopBar has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 4 (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 · GlassLuminance.run (cognitive 28) · ×1
  • GlassLuminance.run (cognitive 28) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/AdaptiveGlass.kt:72 — GlassLuminance.run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ButtonsKt.glassControl (cognitive 28) · ×1
  • ButtonsKt.glassControl (cognitive 28) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Buttons.kt:64 — ButtonsKt.glassControl has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 3, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MorphButtonKt.RectMorphSurface (cognitive 28) · ×1
  • MorphButtonKt.RectMorphSurface (cognitive 28) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:178 — MorphButtonKt.RectMorphSurface has cognitive complexity 28 (threshold 15). Drivers by points: if/else 24, boolean chains 3, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PhotoEditorKt.StraightenDial (cognitive 28) · ×1
  • PhotoEditorKt.StraightenDial (cognitive 28) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:1213 — PhotoEditorKt.StraightenDial has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DigitalSignKt.SignaturesSheet (cognitive 28) · ×1
  • DigitalSignKt.SignaturesSheet (cognitive 28) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:522 — DigitalSignKt.SignaturesSheet has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ops · ×1
  • Ops::next (cognitive 27) engine/crates/content/src/lib.rs:152 — Ops::next has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QuickPreviewKt.Preview (cognitive 27) · ×1
  • QuickPreviewKt.Preview (cognitive 27) android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt:138 — QuickPreviewKt.Preview has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 3, match/switch 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SettingsScreenKt.WallpaperPicker (cognitive 27) · ×1
  • SettingsScreenKt.WallpaperPicker (cognitive 27) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:430 — SettingsScreenKt.WallpaperPicker has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MascotFaceKt.drawEye (cognitive 26) · ×1
  • MascotFaceKt.drawEye (cognitive 26) android/app/src/main/java/com/chethan616/clearpdf/ui/mascot/MascotFace.kt:233 — MascotFaceKt.drawEye has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 4, loops 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · Sheet · ×1
  • Sheet::put_row (cognitive 25) engine/crates/export/src/xlsx.rs:289 — Sheet::put_row has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_oracle · ×1
  • pdfcraft_oracle::pixels::unmatched (cognitive 25) engine/crates/oracle/src/pixels.rs:107 — pdfcraft_oracle::pixels::unmatched has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 4 (10 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolsKt.toolGestures (cognitive 25) · ×1
  • ToolsKt.toolGestures (cognitive 25) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt:117 — ToolsKt.toolGestures has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Discovery · ×1
  • Discovery::walk (cognitive 24) engine/crates/automation/src/batch.rs:143 — Discovery::walk has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, loops 2 (6 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.
D2 · Cognitive Complexity · FieldTable · ×1
  • FieldTable::cells (cognitive 24) engine/crates/forms/src/table.rs:86 — FieldTable::cells has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, loops 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 · Geometry · ×1
  • Geometry::snap (cognitive 24) engine/crates/measure/src/snap.rs:96 — Geometry::snap has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 7 (10 pts), boolean chains 3 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Structure · ×1
  • Structure::get_page_fonts (cognitive 24) engine/crates/render/src/structure.rs:71 — Structure::get_page_fonts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ControlsKt.GlassToggle (cognitive 24) · ×1
  • ControlsKt.GlassToggle (cognitive 24) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Controls.kt:103 — ControlsKt.GlassToggle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21 (24 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TabsKt.GlassTabs (cognitive 24) · ×1
  • TabsKt.GlassTabs (cognitive 24) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Tabs.kt:84 — TabsKt.GlassTabs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22 (23 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SheetGridState.loadBlock (cognitive 24) · ×1
  • SheetGridState.loadBlock (cognitive 24) android/app/src/main/java/com/chethan616/clearpdf/ui/sheets/SheetViewer.kt:304 — SheetGridState.loadBlock has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DetectionPath · ×1
  • DetectionPath::rectangle (cognitive 23) engine/crates/forms/src/detect.rs:69 — DetectionPath::rectangle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PageText · ×1
  • PageText::column_text (cognitive 23) engine/crates/render/src/text.rs:307 — PageText::column_text has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4, match/switch 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MainActivity.collectRequests (cognitive 23) · ×1
  • MainActivity.collectRequests (cognitive 23) android/app/src/main/java/com/chethan616/clearpdf/MainActivity.kt:104 — MainActivity.collectRequests has cognitive complexity 23 (threshold 15). Drivers by points: loops 14, if/else 4 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 3). 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 · FreeTextLayout.wrap (cognitive 23) · ×1
  • FreeTextLayout.wrap (cognitive 23) android/app/src/main/java/com/chethan616/clearpdf/ui/FreeTextLayout.kt:29 — FreeTextLayout.wrap has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FillSignKt.SignaturePadScreen (cognitive 23) · ×1
  • FillSignKt.SignaturePadScreen (cognitive 23) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/FillSign.kt:231 — FillSignKt.SignaturePadScreen has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FormsKt.FieldEditor (cognitive 23) · ×1
  • FormsKt.FieldEditor (cognitive 23) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt:72 — FormsKt.FieldEditor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · VoiceSheetKt.VoiceSheet (cognitive 23) · ×1
  • VoiceSheetKt.VoiceSheet (cognitive 23) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/VoiceSheet.kt:64 — VoiceSheetKt.VoiceSheet has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MindMapKt.MindMapPreview (cognitive 22) · ×1
  • MindMapKt.MindMapPreview (cognitive 22) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:1262 — MindMapKt.MindMapPreview has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ViewerScreenKt.drawNotes (cognitive 22) · ×1
  • ViewerScreenKt.drawNotes (cognitive 22) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerScreen.kt:674 — ViewerScreenKt.drawNotes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MindMapKt.parseOutline (cognitive 21) · ×1
  • MindMapKt.parseOutline (cognitive 21) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/MindMap.kt:315 — MindMapKt.parseOutline has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolsKt.DrawLayer (cognitive 21) · ×1
  • ToolsKt.DrawLayer (cognitive 21) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Tools.kt:174 — ToolsKt.DrawLayer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ViewerSheetsKt.DocumentInfoSheet (cognitive 21) · ×1
  • ViewerSheetsKt.DocumentInfoSheet (cognitive 21) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt:587 — ViewerSheetsKt.DocumentInfoSheet has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · McpServer · ×1
  • McpServer::dispatch (cognitive 20) engine/crates/automation/src/mcp.rs:148 — McpServer::dispatch has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PrintReadiness · ×1
  • PrintReadiness::text (cognitive 20) engine/crates/engine/src/printcheck.rs:69 — PrintReadiness::text has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 4 (6 pts), match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Certificate · ×1
  • Certificate::parse (cognitive 20) engine/crates/sign/src/x509.rs:290 — Certificate::parse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 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.
D2 · Cognitive Complexity · ComponentsKt.PdfField (cognitive 20) · ×1
  • ComponentsKt.PdfField (cognitive 20) android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt:513 — ComponentsKt.PdfField has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SignedData · ×1
  • SignedData::verify_signature_noting (cognitive 19) engine/crates/sign/src/cms.rs:192 — SignedData::verify_signature_noting has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlideDeck · ×1
  • SlideDeck::page_text (cognitive 19) engine/mobile/src/slides.rs:156 — SlideDeck::page_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 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.
D2 · Cognitive Complexity · ClearAppKt.RouteHost (cognitive 19) · ×1
  • ClearAppKt.RouteHost (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/ui/ClearApp.kt:332 — ClearAppKt.RouteHost has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Haptics.fallback (cognitive 19) · ×1
  • Haptics.fallback (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Haptics.kt:115 — Haptics.fallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CommentListKt.CommentListScreen (cognitive 19) · ×1
  • CommentListKt.CommentListScreen (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentList.kt:126 — CommentListKt.CommentListScreen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EditKt.SelectedParagraph (cognitive 19) · ×1
  • EditKt.SelectedParagraph (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:406 — EditKt.SelectedParagraph has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ViewerSheetsKt.MoreSheet (cognitive 19) · ×1
  • ViewerSheetsKt.MoreSheet (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerSheets.kt:88 — ViewerSheetsKt.MoreSheet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. 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 · WidgetCards.pill (cognitive 19) · ×1
  • WidgetCards.pill (cognitive 19) android/app/src/main/java/com/chethan616/clearpdf/widget/WidgetCards.kt:175 — WidgetCards.pill has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17 (19 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · Recipe · ×1
  • Recipe::parse (cognitive 18) engine/crates/automation/src/batch.rs:24 — Recipe::parse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParaProps · ×1
  • ParaProps::merge (cognitive 18) engine/crates/create/src/office/docx.rs:75 — ParaProps::merge has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · pdfcraft_geom · ×1
  • pdfcraft_geom::perspective::solve8 (cognitive 18) engine/crates/geom/src/perspective.rs:54 — pdfcraft_geom::perspective::solve8 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (8 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 · RenderPool · ×1
  • RenderPool::watchdog (cognitive 18) engine/crates/render/src/raster.rs:889 — RenderPool::watchdog has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MobileSession · ×1
  • MobileSession::widgets (cognitive 18) engine/mobile/src/lib.rs:840 — MobileSession::widgets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (5 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 · Thumbnails.ofContent (cognitive 18) · ×1
  • Thumbnails.ofContent (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/engine/LocalFiles.kt:210 — Thumbnails.ofContent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ComponentsKt.SheetRow (cognitive 18) · ×1
  • ComponentsKt.SheetRow (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt:339 — ComponentsKt.SheetRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GlassMotionSettingsKt.BezierEditor (cognitive 18) · ×1
  • GlassMotionSettingsKt.BezierEditor (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/GlassMotionSettings.kt:467 — GlassMotionSettingsKt.BezierEditor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3, boolean chains 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · SettingsScreenKt.ReadAloudLanguagePage (cognitive 18) · ×1
  • SettingsScreenKt.ReadAloudLanguagePage (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/ui/desk/SettingsScreen.kt:261 — SettingsScreenKt.ReadAloudLanguagePage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · HomeScreenKt.HomeScreen (cognitive 18) · ×1
  • HomeScreenKt.HomeScreen (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/ui/home/HomeScreen.kt:164 — HomeScreenKt.HomeScreen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DocLayout.nearestPage (cognitive 18) · ×1
  • DocLayout.nearestPage (cognitive 18) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DocLayout.kt:150 — DocLayout.nearestPage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Colours · ×1
  • Colours::of (cognitive 17) engine/crates/create/src/office/pptx.rs:79 — Colours::of has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 5 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). 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 · Zip · ×1
  • Zip::open (cognitive 17) engine/crates/create/src/office/zip.rs:57 — Zip::open has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pdfcraft_crypt · ×1
  • pdfcraft_crypt::create (cognitive 17) engine/crates/crypt/src/lib.rs:644 — pdfcraft_crypt::create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Graphic · ×1
  • Graphic::draw (cognitive 17) engine/crates/sign/src/graphic.rs:100 — Graphic::draw has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 2 (6 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AppViewModel.openFile (cognitive 17) · ×1
  • AppViewModel.openFile (cognitive 17) android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:215 — AppViewModel.openFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, error handling 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AppViewModel.save (cognitive 17) · ×1
  • AppViewModel.save (cognitive 17) android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:379 — AppViewModel.save has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolScreensKt.PasswordField (cognitive 17) · ×1
  • ToolScreensKt.PasswordField (cognitive 17) android/app/src/main/java/com/chethan616/clearpdf/ui/ToolScreens.kt:296 — ToolScreensKt.PasswordField has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SearchState.run (cognitive 17) · ×1
  • SearchState.run (cognitive 17) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Search.kt:48 — SearchState.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SecurityHandler · ×1
  • SecurityHandler::open (cognitive 16) engine/crates/crypt/src/lib.rs:188 — SecurityHandler::open has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ComponentsKt.PdfSheet (cognitive 16) · ×1
  • ComponentsKt.PdfSheet (cognitive 16) android/app/src/main/java/com/chethan616/clearpdf/ui/Components.kt:186 — ComponentsKt.PdfSheet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CommentDragKt.CommentDragOverlay (cognitive 16) · ×1
  • CommentDragKt.CommentDragOverlay (cognitive 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentDrag.kt:42 — CommentDragKt.CommentDragOverlay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 4, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DigitalSignKt.CertSignScreen (cognitive 16) · ×1
  • DigitalSignKt.CertSignScreen (cognitive 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/DigitalSign.kt:290 — DigitalSignKt.CertSignScreen has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, loops 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · QuickToolsKt.CustomizeToolbar (cognitive 16) · ×1
  • QuickToolsKt.CustomizeToolbar (cognitive 16) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/QuickTools.kt:196 — QuickToolsKt.CustomizeToolbar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 2, boolean chains 1, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · TooManyFunctions · ×1
  • TooManyFunctions: pdfcraft_organize::outline engine/crates/organize/src/outline.rs:83 — TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D3 · God Classes · TooManyFields · ×1
  • TooManyFields: Shown engine/crates/edit/src/text.rs:987 — TooManyFields — 32 stored fields beside 1 method. The bar is 30 stored fields; this is 2 over it, 1.07× 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (42 shared lines) · ×1
  • Near-duplicate member pair (42 shared lines) engine/crates/edit/src/text.rs:1607 — engine/crates/edit/src/text.rs:1607-1734 | engine/crates/edit/src/text.rs:1757-1831 — These two members are variants of one another: 42 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 (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) engine/crates/forms/src/appearance.rs:532 — engine/crates/forms/src/appearance.rs:532-564 | engine/crates/forms/src/appearance.rs:960-1051 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) engine/crates/xfa/src/lib.rs:40 — engine/crates/xfa/src/lib.rs:40-91 | engine/crates/xfdf/src/lib.rs:97-148 — 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 (28 corresponding lines) · ×1
  • Edited copy of a member (28 corresponding lines) engine/crates/engine/src/lib.rs:4165 — engine/crates/engine/src/lib.rs:4165-4192 | engine/crates/engine/src/lib.rs:4194-4221 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) engine/crates/annot/src/lib.rs:1102 — engine/crates/annot/src/lib.rs:1102-1134 | engine/crates/engine/src/lib.rs:2278-2307 — 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 (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) engine/mobile/src/slides.rs:104 — engine/mobile/src/slides.rs:104-140 | engine/mobile/src/word.rs:174-210 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 16+ corresponding lines) engine/crates/edit/src/added.rs:45 — engine/crates/edit/src/added.rs:45-60 | engine/crates/xfa/src/text.rs:34-49 | engine/crates/xfa/src/text.rs:57-72 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×1
  • Edited copy of a member (17 corresponding lines) engine/crates/forms/src/lib.rs:650 — engine/crates/forms/src/lib.rs:650-666 | engine/crates/render/src/inspect.rs:1814-1835 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) engine/crates/engine/src/lib.rs:5324 — engine/crates/engine/src/lib.rs:5324-5334 | engine/crates/engine/src/lib.rs:5344-5355 | engine/crates/engine/src/lib.rs:5359-5367 | engine/crates/engine/src/lib.rs:5371-5378 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 5+ corresponding lines) engine/crates/annot/src/lib.rs:1650 — engine/crates/annot/src/lib.rs:1650-1654 | engine/crates/edit/src/lib.rs:258-262 | engine/crates/forms/src/appearance.rs:31-35 | engine/crates/ocr/src/lib.rs:211-215 | engine/crates/xfa/src/pdf.rs:97-102 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 9+ corresponding lines) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt:65 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Backdrops.kt:65-73 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt:98-106 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/Surfaces.kt:119-129 — 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 (5 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 3+ corresponding lines) engine/crates/annot/src/links.rs:85 — engine/crates/annot/src/links.rs:85-87 | engine/crates/edit/src/added.rs:234-236 | engine/crates/fonts/src/pdf.rs:72-76 | engine/crates/sign/src/pdf.rs:1683-1685 | engine/crates/xfdf/src/lib.rs:245-247 — These 5 members are one piece of code written 5 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 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 7+ corresponding lines) engine/crates/cos/src/object.rs:411 — engine/crates/cos/src/object.rs:411-417 | engine/crates/preflight/src/lib.rs:205-211 | engine/crates/render/src/inspect.rs:1037-1043 — 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 (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) engine/crates/xfa/src/lib.rs:57 — engine/crates/xfa/src/lib.rs:57-91 | engine/crates/xfdf/src/lib.rs:114-148 — before extracting anything, compare `engine/crates/xfa/src/lib.rs` and `engine/crates/xfdf/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `engine/crates/xfa/src/lib.rs:57` 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 (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) engine/crates/forms/src/appearance.rs:537 — engine/crates/forms/src/appearance.rs:537-564 | engine/crates/forms/src/appearance.rs:1022-1049 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/forms/src/appearance.rs:537` 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–26 lines × 2) · ×1
  • Duplicated block (25–26 lines × 2) engine/crates/edit/src/text.rs:1653 — engine/crates/edit/src/text.rs:1653-1678 | engine/crates/edit/src/text.rs:1775-1799 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/edit/src/text.rs:1653` 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 (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) engine/crates/redact/src/lib.rs:448 — engine/crates/redact/src/lib.rs:448-462 | engine/crates/redact/src/sanitize.rs:392-404 — 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 `engine/crates/redact/src/lib.rs:448` it does not close everything it opens, so those 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 (20–22 lines × 3) · ×1
  • Duplicated block (20–22 lines × 3) engine/crates/a11y/src/lib.rs:515 — engine/crates/a11y/src/lib.rs:515-536 | engine/crates/forms/src/table.rs:379-398 | engine/crates/print/src/lib.rs:93-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) engine/crates/cos/src/document.rs:1984 — engine/crates/cos/src/document.rs:1984-1997 | engine/crates/cos/src/document.rs:2054-2065 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/crates/cos/src/document.rs:1984` 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 (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) engine/crates/preflight/src/xmp.rs:83 — engine/crates/preflight/src/xmp.rs:83-95 | engine/crates/xfa/src/lib.rs:67-79 | engine/crates/xfdf/src/lib.rs:124-136 — before extracting anything, compare `engine/crates/xfa/src/lib.rs` and `engine/crates/xfdf/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `engine/crates/preflight/src/xmp.rs:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 lines × 4) · ×1
  • Duplicated block (10 lines × 4) engine/crates/a11y/src/headings.rs:215 — engine/crates/a11y/src/headings.rs:215-224 | engine/crates/edit/src/inline_forms.rs:668-677 | engine/crates/edit/src/text.rs:1280-1289 | engine/crates/redact/src/interp.rs:928-937 — 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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) engine/crates/forms/src/lib.rs:507 — engine/crates/forms/src/lib.rs:507-516 | engine/crates/model/src/lib.rs:169-178 | engine/crates/organize/src/lib.rs:112-121 — before extracting anything, compare `engine/crates/forms/src/lib.rs` and `engine/crates/organize/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) engine/crates/edit/src/text.rs:1638 — engine/crates/edit/src/text.rs:1638-1646 | engine/crates/edit/src/text.rs:1763-1770 — both copies are in the same file, so extract the 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.
D4 · Code Duplication · Duplicated block (3–8 lines × 3) · ×1
  • Duplicated block (3–8 lines × 3) engine/crates/edit/src/images.rs:660 — engine/crates/edit/src/images.rs:660-662 | engine/crates/edit/src/images.rs:678-685 | engine/crates/edit/src/images.rs:748-755 — 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 `engine/crates/edit/src/images.rs:660` 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 (2–8 lines × 3) · ×1
  • Duplicated block (2–8 lines × 3) engine/crates/optimize/src/links.rs:44 — engine/crates/optimize/src/links.rs:44-51 | engine/crates/organize/src/import.rs:599-600 | engine/crates/organize/src/import.rs:622-629 — 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 `engine/crates/optimize/src/links.rs:44` 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 (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) engine/crates/audit/src/cover.rs:319 — engine/crates/audit/src/cover.rs:319-324 | engine/crates/edit/src/text.rs:774-779 | engine/crates/edit/src/text.rs:2082-2087 | engine/crates/redact/src/lib.rs:252-257 — 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. 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 × 3) · ×1
  • Duplicated block (21 lines × 3) engine/crates/preflight/src/xmp.rs:54 — engine/crates/preflight/src/xmp.rs:54-74 | engine/crates/xfa/src/lib.rs:41-61 | engine/crates/xfdf/src/lib.rs:98-118 — before extracting anything, compare `engine/crates/xfa/src/lib.rs` and `engine/crates/xfdf/src/lib.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 `engine/crates/preflight/src/xmp.rs:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) engine/crates/engine/src/lib.rs:4322 — engine/crates/engine/src/lib.rs:4322-4326 | engine/crates/engine/src/lib.rs:4378-4380 | engine/crates/engine/src/lib.rs:4463-4467 — 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 `engine/crates/engine/src/lib.rs:4322` 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 (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) engine/crates/forms/src/appearance.rs:917 — engine/crates/forms/src/appearance.rs:917-920 | engine/crates/forms/src/appearance.rs:1099-1103 | engine/crates/forms/src/appearance.rs:1135-1139 — 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 `engine/crates/forms/src/appearance.rs:1099` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `engine/crates/forms/src/appearance.rs:1098` calls `set`, `to_vec`, `name` and `engine/crates/forms/src/appearance.rs:917` 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 (8 lines × 3) · ×1
  • Duplicated block (8 lines × 3) engine/crates/cos/src/parser.rs:401 — engine/crates/cos/src/parser.rs:401-408 | engine/crates/create/src/office/rtf.rs:310-317 | engine/crates/filters/src/asciihex.rs:8-15 — 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.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×1
  • Duplicated block (15 lines × 2) engine/crates/edit/src/added.rs:422 — engine/crates/edit/src/added.rs:422-436 | engine/crates/edit/src/bidi.rs:60-74 — 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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×1
  • Duplicated block (19 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:604 — android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:604-622 | android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:630-648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/notes/PhotoEditor.kt:604` 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 (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageMenu.kt:77 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageMenu.kt:77-88 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ViewerOverlays.kt:224-234 — 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 `android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/PageMenu.kt:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:440 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:440-453 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:309-321 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:418 — android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:418-424 | android/app/src/main/java/com/chethan616/clearpdf/ui/glass/MorphButton.kt:301-305 — 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 `android/app/src/main/java/com/chethan616/clearpdf/ui/glass/LiquidMorph.kt:418` 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 (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:419 — android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:419-426 | android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:643-649 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:419` 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, `android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:428` calls `pointerInput`, `startInlineEdit` and `android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Edit.kt:651` 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.
D5 · Coupling · Unstable project pdfcraft-a11y · ×1
  • Unstable project pdfcraft-a11y — pdfcraft-a11y has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project pdfcraft-automation · ×1
  • Unstable project pdfcraft-automation — pdfcraft-automation has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project pdfcraft-engine · ×1
  • Unstable project pdfcraft-engine — pdfcraft-engine has instability 0.92 with 2 dependents.
D5 · Coupling · Unstable project pdfcraft-optimize · ×1
  • Unstable project pdfcraft-optimize — pdfcraft-optimize has instability 0.83 with 1 dependents.
D5 · Coupling · Unstable project pdfcraft-redact · ×1
  • Unstable project pdfcraft-redact — pdfcraft-redact has instability 0.89 with 1 dependents.
D6 · Cohesion (LCOM4) · Low cohesion · ×1
  • Low cohesion: u32x8 (LCOM4 5) engine/vendor/hayro-jbig2/src/simd.rs:30 — u32x8's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
X12 · Unreachable branch · Statement is unreachable · ×1
  • Statement is unreachable — control never gets past the statement before it engine/crates/automation/src/mcp.rs:508 — `let r = parse_uri(uri).ok_or(( INVALID_PARAMS, format !("unknown resource {ur…` follows `{ let content = self.automation.call(tool, & json !({ })).map_err(| e |(INVAL…` (line 497) in the same block, and control never passes that statement — it returns, breaks, continues, panics, exits or calls a function that never returns. This code cannot run for any input; rustc warns `unreachable_code` on it. Delete it, or move it before the statement that leaves if it was meant to run.
Minor — 57 finding(s)
X7 · Silent fallback defaults · Silent fallback default on Err · ×24
  • Silent fallback default on Err engine/crates/annot/src/lib.rs:2418 — `summaries` turns every `Err` into `0.0` — 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 engine/crates/annot/src/links.rs:149 — `list` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/create/src/office/xml.rs:153 — `relationships` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/edit/src/added.rs:1278 — `own_fonts` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/engine/src/lib.rs:4820 — `print_text_up` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/engine/src/lib.rs:488 — `undrawn_notices` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/fonts/src/pdf.rs:159 — `cids_with_outlines` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/fonts/src/script.rs:305 — `script_outline` turns every `Err` into `ScriptOutline::default()` — 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 engine/crates/organize/src/import.rs:703 — `field_name_conflicts` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/organize/src/import.rs:718 — `combine_field_conflicts` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/organize/src/view.rs:79 — `initial_view` turns every `Err` into `InitialView::default()` — 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 engine/crates/render/src/inspect.rs:1505 — `annotations` turns every `Err` into `0.0` — 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 engine/crates/sign/src/keychain.rs:61 — `issuers` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/sign/src/windows.rs:90 — `issuers` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/xfa/src/data.rs:1764 — `values_at` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/crates/xfa/src/data.rs:1888 — `password_dataset_wants` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/deckcraft-fonts/src/fallback.rs:237 — `ligature_carets` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/deckcraft-fonts/src/fontdb.rs:542 — `file_face_names` turns every `Err` into `vec![]` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/lopdf/src/document.rs:748 — `get_page_annotations` turns every `Err` into `Ok(vec![])` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/lopdf/src/document.rs:954 — `size_hint` 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 engine/vendor/lopdf/src/reader.rs:711 — `extract_page_count` turns every `Err` into `Ok(0)` — 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 engine/vendor/wordcraft-engine/src/cmd/inspector.rs:60 — `differences` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/wordcraft-engine/src/cmd/table/structure.rs:157 — `split_targets` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err engine/vendor/wordcraft-fonts/src/fontdb/names.rs:138 — `file_face_names` turns every `Err` into `vec![]` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
X10 · Duplicated predicate · Duplicated predicate · ×10
  • Duplicated predicate android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:2068 — `!it.readOnly && (it.kind == "text" || it.kind == "combo" || it.kind == "list")` appears character-identically in 2 files — android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt, android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/Forms.kt. 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 android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt:3453 — `it.page == c.page && it.index == c.index` appears character-identically in 2 files — android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt, android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/CommentPanel.kt. 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 engine/crates/annot/src/tests.rs:1255 — `!doc.encryption_changed() && !doc.full_save_required()` appears character-identically in 2 files — engine/crates/annot/src/tests.rs, engine/crates/forms/src/tests.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 engine/crates/organize/src/labels.rs:205 — `!kids.is_empty() && depth == MAX_LABEL_TREE_DEPTH` appears character-identically in 2 files — engine/crates/organize/src/labels.rs, engine/crates/render/src/inspect.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 engine/crates/redact/src/lib.rs:469 — `!out.xobjects.is_empty() || !out.replaced.is_empty()` appears character-identically in 2 files — engine/crates/redact/src/lib.rs, engine/crates/redact/src/sanitize.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 engine/crates/forms/src/lib.rs:658 — `!visited.insert(p) || visited.len() > 64` appears character-identically in 2 files — engine/crates/forms/src/lib.rs, engine/crates/render/src/inspect.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 engine/crates/redact/src/lib.rs:467 — `changed || !out.xobjects.is_empty() || !out.replaced.is_empty()` appears character-identically in 2 files — engine/crates/redact/src/lib.rs, engine/crates/redact/src/sanitize.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 engine/crates/model/src/lib.rs:185 — `d.name(b"Type") == Some(b"Pages") || (d.contains(b"Kids") && d.name(b"Type") != Some(b"Page"))` appears character-identically in 3 files — engine/crates/model/src/lib.rs, engine/crates/organize/src/lib.rs, engine/crates/redact/src/interp.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 engine/crates/annot/src/tests.rs:526 — `long.len() > 3 && long.concat() == "Supercalifragilisticexpialidocious"` appears character-identically in 2 files — engine/crates/annot/src/tests.rs, engine/crates/fonts/src/lib.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 engine/crates/annot/src/appearance.rs:818 — `rect[2] - rect[0] < 1.0 || rect[3] - rect[1] < 1.0` appears character-identically in 2 files — engine/crates/annot/src/appearance.rs, engine/crates/automation/src/forms.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 · Silent fallback default in catch · ×7
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/engine/DigitalIds.kt:67 — `load` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/engine/RecentFiles.kt:73 — `read` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/notes/Notes.kt:258 — `read` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:162 — `languages` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:244 — `loadPage` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:287 — `speakCurrent` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch android/app/src/main/java/com/chethan616/clearpdf/ui/viewer/ReadAloud.kt:301 — `markWord` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. 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 in the catch or in the KDoc, and the row stops firing.
M4 · Documentation accuracy · README/code drift · ×6
  • README/code drift engine/crates/automation/README.md:42 — engine/crates/automation/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift engine/crates/automation/README.md:174 — engine/crates/automation/README.md links to `../../docs/mcp.md`, but `engine/docs/mcp.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift engine/crates/automation/README.md:193 — engine/crates/automation/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift engine/crates/automation/README.md:194 — engine/crates/automation/README.md links to `../../docs/editing-images.md`, but `engine/docs/editing-images.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift engine/crates/engine/README.md:7 — engine/crates/engine/README.md links to `../../docs/word-count.md`, but `engine/docs/word-count.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift engine/crates/fonts/README.md:91 — engine/crates/fonts/README.md links to `../../docs/editing-existing-text.md`, but `engine/docs/editing-existing-text.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found engine/mobile/bindgen/Cargo.toml:9 — 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 `engine/mobile/bindgen/Cargo.toml` makes this repository a deployable product (line 9).
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion android/app/build.gradle.kts:1 — `android/app` (33930 LoC, 475 module-visible types across 16 directories) overshoots its size bounds. 1 of 38 build unit(s) (Cargo, Gradle, checkout) overshoot their size bounds, lowering Project Cohesion to 9.5/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
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 2/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `engine/mobile/bindgen`.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation engine/Cargo.toml:13 — `engine/Cargo.toml` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Minor — 107 finding(s)
D12 · Dependency Hygiene · Outdated (compile) · ×107
  • Outdated (compile): com.google.guava:guava — com.google.guava:guava 33.3.1-jre → 33.8.0-android available.
  • Outdated (compile): com.google.guava:failureaccess — com.google.guava:failureaccess 1.0.2 → 1.0.3 available.
  • Outdated (compile): org.checkerframework:checker-qual — org.checkerframework:checker-qual 3.43.0 → 4.4.0 available.
  • Outdated (compile): com.google.errorprone:error_prone_annotations — com.google.errorprone:error_prone_annotations 2.28.0 → 2.52.0 available.
  • Outdated (compile): com.google.j2objc:j2objc-annotations — com.google.j2objc:j2objc-annotations 3.0.0 → 3.1 available.
  • Outdated (compile): net.java.dev.jna:jna-platform — net.java.dev.jna:jna-platform 5.6.0 → 5.19.1 available.
  • Outdated (compile): net.java.dev.jna:jna — net.java.dev.jna:jna 5.6.0 → 5.19.1 available.
  • Outdated (compile): org.jetbrains.kotlin:kotlin-stdlib-jdk8 — org.jetbrains.kotlin:kotlin-stdlib-jdk8 2.2.10 → 2.4.21 available.
  • Outdated (compile): org.jetbrains.kotlin:kotlin-stdlib — org.jetbrains.kotlin:kotlin-stdlib 2.2.10 → 2.4.21 available.
  • Outdated (compile): org.jetbrains:annotations — org.jetbrains:annotations 23.0.0 → 26.1.0 available.
  • Outdated (compile): org.jetbrains.kotlin:kotlin-stdlib-jdk7 — org.jetbrains.kotlin:kotlin-stdlib-jdk7 2.2.10 → 2.4.21 available.
  • Outdated (compile): com.google.protobuf:protobuf-java — com.google.protobuf:protobuf-java 3.25.5 → 4.36.2 available.
  • Outdated (compile): com.google.code.gson:gson — com.google.code.gson:gson 2.11.0 → 2.15.0 available.
  • Outdated (compile): com.google.jimfs:jimfs — com.google.jimfs:jimfs 1.1 → 1.3.2 available.
  • Outdated (compile): org.apache.commons:commons-compress — org.apache.commons:commons-compress 1.27.1 → 1.28.0 available.
  • Outdated (compile): commons-codec:commons-codec — commons-codec:commons-codec 1.17.1 → 1.23.0 available.
  • Outdated (compile): commons-io:commons-io — commons-io:commons-io 2.16.1 → 2.22.0 available.
  • Outdated (compile): org.apache.commons:commons-lang3 — org.apache.commons:commons-lang3 3.16.0 → 3.22.0 available.
  • Outdated (compile): org.glassfish.jaxb:jaxb-runtime — org.glassfish.jaxb:jaxb-runtime 2.3.2 → 4.0.9 available.
  • Outdated (compile): jakarta.xml.bind:jakarta.xml.bind-api — jakarta.xml.bind:jakarta.xml.bind-api 2.3.2 → 4.0.5 available.
  • Outdated (compile): jakarta.activation:jakarta.activation-api — jakarta.activation:jakarta.activation-api 1.2.1 → 2.1.4 available.
  • Outdated (compile): org.glassfish.jaxb:txw2 — org.glassfish.jaxb:txw2 2.3.2 → 4.0.9 available.
  • Outdated (compile): com.sun.istack:istack-commons-runtime — com.sun.istack:istack-commons-runtime 3.0.8 → 4.2.0 available.
  • Outdated (compile): org.jvnet.staxex:stax-ex — org.jvnet.staxex:stax-ex 1.8.1 → 2.1.0 available.
  • Outdated (compile): com.sun.xml.fastinfoset:FastInfoset — com.sun.xml.fastinfoset:FastInfoset 1.2.16 → 2.1.1 available.
  • + 82 more in this group — see findings.md.

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 --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-8438a19701fe4806a67c644b7c93ee28/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=290" --report-format json --report-path /tmp/watchdog-gitleaks-8438a19701fe4806a67c644b7c93ee28/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.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-8438a19701fe4806a67c644b7c93ee28/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 .12artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .11artifacts/raw/osv-scanner.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 14 file(s) — `android/app/src/main/java/com/chethan616/clearpdf/engine/DocumentFiles.kt`, `android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreview.kt`, `android/app/src/main/java/com/chethan616/clearpdf/preview/QuickPreviewActivity.kt`, `android/app/src/main/java/com/chethan616/clearpdf/ui/AppViewModel.kt`, `android/app/src/main/java/com/chethan616/clearpdf/ui/FreeTextLayout.kt`, … (+9 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.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 Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1e858-0bee-76db-8d2c-1726f9c0beaf · 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