Public report of loro-dev/loro, published 27 October 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.10.5). Watchdog 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, 27 October 2026, 19:38 UTC · Survey ID cd_0688eb397bba45cb9ecc277de59b1e27

loro-dev/loro

Measured 27 October 2026, 19:18 UTC, at code version 75e4bf2

No regression since the last survey Code coverage: not measured

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

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

CAI score 57out of 100 At risk Down 1 since the last survey

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

A large codebase: 150,972 lines of product code in 20 projects, tests not counted · Estimated rebuild effort: about 1.9 person-years · Weakest lens: Code Health, 46

Findings by how serious they are

92 critical 1095 serious 92 minor

10 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
27 October 2026, 19:18 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 Watchdog. It is open to any tool that implements it, and today Watchdog 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. Watchdog works 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 ▸

74of 74 dimensions measured by tools.
1239of 1279 findings point to an exact file and line, so you can open each one in the code. The other 40 concern the repository as a whole, such as missing documentation.
74dimensions across 6 lenses, read from 150,972 lines of product code in 20 projects.
Chapters

Executive summary

loro-dev/loro is rated At risk because critical security findings are open. It scores 57 out of 100, which the At risk rating leaves unchanged.

Code Health, at 46, is the weakest lens and counts most in the score. The best first step is splitting the oversized files, worth about 7 points. Writing log messages as searchable templates is another step, worth about 3 points. Raising Code Health to 70 would lift the score to about 67.

Forty known security holes in the packages the code depends on can be used by attackers. Thirty pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and eight settings leave the servers or containers unsafe. Updating the vulnerable packages, pinning each tool to an exact version and correcting the unsafe settings would close these risks. Limiting each secret to its own step would fix the three secrets exposed to more of the pipeline than needed, and the three pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The loop of files that import each other needs breaking.

The product code is 150,972 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.
Code Health 46 · counts for 46%Security and Compliance 64 · counts for 25%Maturity 67 · counts for 14%Production Readiness 68 · counts for 8%Performance 71 · counts for 4%Architecture 92 · counts for 2%

If Code Health rose from 46 to 70, the lowest score rated Strong, the score would rise from 57 to about 67.

Code composition: what the lines of code are
Product code 57%Tests 43%
New since the last survey: 85 findings

These 85 critical or serious findings weren't in the previous survey, on 13 October 2026.

Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 136 findings

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

  • Cyclomatic Complexity · LoroDoc::_apply_diff (cyclomatic 26) crates/loro-internal/src/loro.rs
  • Cyclomatic Complexity · document.transformListDelta (cyclomatic 22) REDACTED
  • Cyclomatic Complexity · LoroDoc.#indexHistoryOperations (cyclomatic 19) REDACTED
  • Cyclomatic Complexity · LoroDoc::commit_internal (cyclomatic 18) crates/loro-internal/src/loro.rs
  • Cyclomatic Complexity · LoroDoc.#withoutLiveChildInserts (cyclomatic 18) REDACTED
  • Cognitive Complexity · LoroDoc::_apply_diff (cognitive 54) crates/loro-internal/src/loro.rs
  • Cognitive Complexity · LoroDoc::commit_internal (cognitive 33) crates/loro-internal/src/loro.rs
  • Cognitive Complexity · document.transformListDelta (cognitive 31) REDACTED
  • Cognitive Complexity · LoroDoc.#applyOperation (cognitive 20) REDACTED
  • Cognitive Complexity · LoroDoc.#withoutLiveChildInserts (cognitive 18) REDACTED
  • Cognitive Complexity · LoroDoc::import_batch (cognitive 17) crates/loro-internal/src/loro.rs
  • Cognitive Complexity · InnerStore::track_value_cache (cognitive 17) crates/loro-internal/src/state/container_store/inner_store.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/loro-wasm/src/counter.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/loro-internal/src/handler.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/generic-btree/src/generic_impl/gap_buffer.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/loro-internal/src/state/richtext_state.rs
  • Code Duplication · Duplicated block (22 lines × 2) crates/loro-internal/src/encoding/outdated_encode_reordered.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) crates/loro-internal/src/diff_calc.rs
  • Code Duplication · Duplicated block (11 lines × 2) crates/loro-internal/src/state/list_state.rs
  • Explicit Debt · FixmeComment crates/loro/tests/integration_test/undo_test.rs
  • Explicit Debt · FixmeComment crates/loro/tests/integration_test/undo_test.rs
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Dependency Vulnerabilities · Critical CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium vulnerability: REDACTED REDACTED
  • Dependency Vulnerabilities · Medium CVE: [GHSA redacted] REDACTED
  • Supply-chain Provenance & Signing REDACTED
  • Code Duplication · Duplicated block (15 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (13 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (13 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (13 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (13 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (13 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (12 lines × 2 locations) crates/loro-wasm/index.ts
  • Code Duplication · Duplicated block (12 lines × 2 locations) crates/loro-wasm/scripts/measure-snapshot-round-memory.cjs
  • Code Duplication · Duplicated block (12 lines × 2 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (12 lines × 2 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (12 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/codec/bytes.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/codec/change-block-tables.ts
  • Code Duplication · Duplicated block with local edits (11 matched lines × 2 locations) loro-js/src/codec/container-id.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/jsonpath.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/sequence-deletion-index.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (11 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (11 lines × 3 locations) loro-js/src/runtime/text-style-index.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/codec/document.ts
  • Code Duplication · Duplicated block (10 lines × 3 locations) loro-js/src/codec/serde-columnar.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (10 lines × 4 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (10 lines × 3 locations) REDACTED
  • Code Duplication · Duplicated block (10 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (10 lines × 3 locations) REDACTED
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/runtime/event-diff.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (10 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) loro-js/src/codec/change-block-codec.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block with local edits (9 matched lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (9 lines × 2 locations) loro-js/src/runtime/jsonpath.ts
  • Code Duplication · Duplicated block with local edits (9 matched lines × 2 locations) loro-js/src/runtime/ordered-index.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (9 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/scripts/rewrite-rust-fixture.mjs
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/codec/change-block-codec.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/codec/change-block-codec.ts
  • Code Duplication · Duplicated block with local edits (8 matched lines × 2 locations) loro-js/src/codec/change-block-tables.ts
  • Code Duplication · Duplicated block (8 lines × 3 locations) loro-js/src/codec/change-block-tables.ts
  • Code Duplication · Duplicated block (8 lines × 3 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/codec/state-snapshot.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/runtime/containers.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) REDACTED
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/runtime/ordered-index.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/runtime/sequence-index.ts
  • Code Duplication · Duplicated block (8 lines × 2 locations) loro-js/src/runtime/text-style-index.ts
Rebuild cost: about €270,000 · Estimate
Cost to rebuild€90,000 to €450,000, for 1,500 to 4,759 hours of work, about 1.9 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 57. 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: 150,972 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: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 7 points · Medium effort · Large Files
2
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Raises the score by about 1 point · Low effort · ADR Quality
3
Interpolated log message defeats structured logging
Raises the score by about 3 points · Medium effort · Structured logging

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.9 person-years of work. Its weakest lens is Code Health, at 46 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.3 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 92,917 lines over the last 90 days, which is about 376,830 lines a year. At that pace, the extra work comes to an estimated 18.8 to 125.6 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 Watchdog's 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 @loro-dev/fractional-index fractional-index bench-utils bench-utils loro-common loro-common bench-utils->loro-common crates/loro-internal/deno.json json crates/loro-wasm/scripts/deno.json json dev-utils dev-utils generic-btree generic-btree json-float-consumer json-float-consumer loro (Cargo) loro (Cargo) json-float-consumer->loro (Cargo) loro (Cargo)->generic-btree loro (Cargo)->loro-common loro-delta loro-delta loro (Cargo)->loro-delta loro-internal loro-internal loro (Cargo)->loro-internal loro-kv-store loro-kv-store loro (Cargo)->loro-kv-store loro (npm) loro (npm) loro-rle loro-rle loro-common->loro-rle loro-crdt loro-crdt loro-delta->generic-btree loro-internal->generic-btree loro-internal->loro-common loro-internal->loro-delta loro-internal->loro-kv-store loro-internal->loro-rle loro_fractional_index loro_fractional_index loro-internal->loro_fractional_index loro-kv-store->loro-common loro-wasm loro-wasm loro-wasm->loro-common loro-wasm->loro-delta loro-wasm->loro-internal loro-wasm->loro-rle loro-wasm-tools loro-wasm-tools loro.js js scripts/deno.json json

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.

222 modules, with 893 dependencies between them. 3 loops run through 84 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 182 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 dev_utils2 generic_btree.rle3 loro-js.src.runtime.document4 loro_common.internal_string5 loro_internal.arena.str_arena6 loro_internal.configure7 loro-js.src.runtime8 loro_common.span9 loro_internal.container.idx10 loro_internal.version.frontiers11 loro_internal.change12 loro_internal.container.richtext.tracker.crdt_rope13 loro_internal.container.richtext.richtext_state14 loro_internal.oplog.loro_dag15 loro_internal.version16 loro_internal.diff_calc17 loro_internal.history_cache18 loro_internal.event19 loro.event20 loro_internal.state.list_state21 loro_internal.state.movable_list_state22 loro_internal.state.tree_state23 loro_internal.state24 loro_internal.loro25 loro_internal.txn26 loro_internal27 loro_internal.handler28 loro29 loro_internal.encoding30 loro_internal.oplog31 loro_internal.oplog.change_store32 loro_internal.op33 loro_internal.arena34 loro_common35 loro_common.value36 loro_internal.container.richtext.style_range_map37 generic_btree.generic_impl.rope38 generic_btree39 loro_internal.state.richtext_state40 loro_wasm
1 dev_utils
2 generic_btree.rle
3 loro-js.src.runtime.document
4 loro_common.internal_string
5 loro_internal.arena.str_arena
6 loro_internal.configure
7 loro-js.src.runtime7
8 loro_common.span484
9 loro_internal.container.idx12
10 loro_internal.version.frontiers2
11 loro_internal.change12322
12 loro_internal.container.richtext.tracker.crdt_rope111310
13 loro_internal.container.richtext.richtext_state161141313
14 loro_internal.oplog.loro_dag32341422
15 loro_internal.version45214
16 loro_internal.diff_calc729773
17 loro_internal.history_cache211311221741
18 loro_internal.event2121152
19 loro.event13
20 loro_internal.state.list_state5111111414211
21 loro_internal.state.movable_list_state51111141821
22 loro_internal.state.tree_state1111151113
23 loro_internal.state11256311283111122541
24 loro_internal.loro1111112112124
25 loro_internal.txn32112211123112
26 loro_internal121132121612211
27 loro_internal.handler31171919103
28 loro11131211011584
29 loro_internal.encoding1314111
30 loro_internal.oplog111212141111446
31 loro_internal.oplog.change_store313425176
32 loro_internal.op387312101
33 loro_internal.arena13313
34 loro_common41113
35 loro_common.value121
36 loro_internal.container.richtext.style_range_map5122
37 generic_btree.generic_impl.rope114
38 generic_btree464
39 loro_internal.state.richtext_state111111411211
40 loro_wasm2122116142
Uses a module listed above itPart of a loopThe module itself
1 dev_utils2 generic_btree.rle3 loro-js.src.runtime.document4 loro_common.internal_string5 loro_internal.arena.str_arena6 loro_internal.configure7 loro-js.src.runtime8 loro_common.span9 loro_internal.container.idx10 loro_internal.version.frontiers11 loro_internal.change12 loro_internal.container.richtext.tracker.crdt_rope13 loro_internal.container.richtext.richtext_state14 loro_internal.oplog.loro_dag15 loro_internal.version16 loro_internal.diff_calc17 loro_internal.history_cache18 loro_internal.event19 loro.event20 loro_internal.state.list_state21 loro_internal.state.movable_list_state22 loro_internal.state.tree_state23 loro_internal.state24 loro_internal.loro25 loro_internal.txn26 loro_internal27 loro_internal.handler28 loro29 loro_internal.encoding30 loro_internal.oplog31 loro_internal.oplog.change_store32 loro_internal.op33 loro_internal.arena34 loro_common35 loro_common.value36 loro_internal.container.richtext.style_range_map37 generic_btree.generic_impl.rope38 generic_btree39 loro_internal.state.richtext_state40 loro_wasmdev_utils1generic_btree.rle2loro-js.src.runtime.document3loro_common.internal_string4loro_internal.arena.str_arena5loro_internal.configure6loro-js.src.runtime7loro_common.span8loro_internal.container.idx9loro_internal.version.frontiers10loro_internal.change11loro_internal.container.richtext.tracker.crdt_rope12loro_internal.container.richtext.richtext_state13loro_internal.oplog.loro_dag14loro_internal.version15loro_internal.diff_calc16loro_internal.history_cache17loro_internal.event18loro.event19loro_internal.state.list_state20loro_internal.state.movable_list_state21loro_internal.state.tree_state22loro_internal.state23loro_internal.loro24loro_internal.txn25loro_internal26loro_internal.handler27loro28loro_internal.encoding29loro_internal.oplog30loro_internal.oplog.change_store31loro_internal.op32loro_internal.arena33loro_common34loro_common.value35loro_internal.container.richtext.style_range_map36generic_btree.generic_impl.rope37generic_btree38loro_internal.state.richtext_state39loro_wasm40748412212322111310161141313323414224521472977321131122174121211521351111114142115111114182111111511131125631128311112254111111121121243211221112311212113212161221131171919103111312110115841314111111212141111446313425176387312101133134111312151221144641111114112112122116142+182 more modules (most-connected shown)

At a glance — Code Health · 46% · Weak · gated by D2, R3, X4 ·

At a glance — Architecture · 92% · Exemplary ·

At a glance — Maturity · 67% · Adequate ·

At a glance — Readiness · 68% · Adequate ·

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

At a glance — Performance · 71% · Strong ·

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 Failures98High / Critical
A05:2025 — Injection45High / Critical
A02:2025 — Security Misconfiguration12High / Critical
A07:2025 — Authentication Failures3High / Critical

Roadmap

Begin by splitting the largest source files into smaller, focused modules to improve maintainability and address structural complexity. Next, replace interpolated log messages with structured logging formats and eliminate empty catch blocks to ensure proper exception handling and observability. Finally, resolve the missing architectural decision records to document key design choices, and review cryptographic implementations to replace weak hashes with secure alternatives where necessary.

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

Do thisHelpsEffortDimension
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+7.0 ptsMediumLarge Files
Resolve the 1 No ADRs found finding(s) in ADR Quality.+1.5 ptsLowADR Quality
Interpolated log message defeats structured logging+2.8 ptsMediumStructured logging
Resolve the 8 High IaC finding(s) in IaC & Container Security — start with REDACTED (8).+0.7 ptsLowIaC & Container Security
Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED (2).+0.7 ptsLowSecrets (history)
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED.+0.7 ptsLowStatic Analysis (SAST)
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED.+0.7 ptsLowStatic Analysis (SAST)
Resolve the 1 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED.+0.7 ptsLowDependency Vulnerabilities

File quality

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

FileScoreBandWorst signal
REDACTED0.2SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.5SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED3.7SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
crates/loro-internal/src/version.rs5.5MixedCognitive Complexity: VersionVector::partial_cmp (cognitive 18)
crates/loro-internal/src/state/list_state.rs5.6MixedCyclomatic Complexity: ListState::delete_range (cyclomatic 16)
crates/loro-internal/src/container/richtext/style_range_map.rs5.6MixedCode Duplication: Duplicated block (14 lines × 2)
REDACTED5.8MixedDependency Vulnerabilities: Critical CVE: REDACTED
crates/loro-internal/src/dag.rs6.0MixedExplicit Debt: TodoComment
crates/loro-internal/src/loro.rs6.0MixedExplicit Debt: TodoComment
crates/loro-internal/src/state/richtext_state.rs6.0MixedExplicit Debt: TodoComment
crates/loro-internal/src/state/movable_list_state.rs6.0MixedExplicit Debt: TodoComment
crates/loro-internal/src/state.rs6.0MixedExplicit Debt: TodoComment

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

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

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

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

Could not be resolved — 10

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

Watchdog 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. 74 of 74 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three 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; ◐ Advisory — an LLM prose judgement. 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; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 74 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D17D19D20D26D28D29D30D31D34D35D36D43D44AX10AX3AX4AX6AX8AX9M1M2M3M4P1P10P2P3P4P6PF1PF3R1R10R2R3R4R6R7R8R9S1X1X12X13X14X15X16X17X18X19X21X22X23X24X25X27X28X29X3X30X4X5

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, 1239 of 1279 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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
Watchdog 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 · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a17ecd-0af8-7d6e-8b83-d868c1f3f5bc.

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

Run transparency — what happened this run

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

  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 926 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 248 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and did not finish re-running within its tier budget — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in crates/loro-wasm/ (4 tests); vitest via `pnpm install --frozen-lockfile --ignore-scripts` in loro-js/ (518 tests); vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/fractional-index/ (20 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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 REDACTED, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (41 contributor(s) across 2249 commit(s) sampled, automation and bot accounts excluded). One of them holds 80% of the history; the other 40 hold 0.5% 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 — Watchdog measured this, but not all of it. What it 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog 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 — Watchdog 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `crates/loro-wasm/index.ts`, `loro-js/src/runtime/containers.ts`, `REDACTED`, `loro-js/src/runtime/jsonpath.ts` 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.
  • AX1 Captive dependencies — not measured this run — Watchdog 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 Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in loro-js/src/runtime/containers.ts, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 88 further occurrence(s) are not listed individually; the score already reflects all 128.

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

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does 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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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 is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • 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: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • 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 Complexity6.1 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

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

142 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was loro_internal::dag::_find_meet_and_mode at 92. A further 10 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 document.decodedOperationToJson at 23 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/loro-common/src/value.rs (LoroValue::serialize at 18). 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.

loro_internal::dag::_find_meet_and_mode (cyclomatic 92) · ×18crates/loro-internal/src/dag.rs:710
LoroDoc::check_apply_diff_creates_no_unknown_container (cyclomatic 48) · ×7crates/loro-internal/src/loro.rs:2369
RichtextState::apply_diff (cyclomatic 40) · ×4crates/loro-internal/src/state/richtext_state.rs:615
DocState::apply_diff (cyclomatic 37) · ×4crates/loro-internal/src/state.rs:664
BTree::handle_lack_single_layer (cyclomatic 22) · ×3crates/generic-btree/src/lib.rs:2004

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

What to do

  1. Bring the 2 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with loro_internal::dag::_find_meet_and_mode (cyclomatic 92), LoroDoc.#importBlob (cyclomatic 81). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 2 together lifts Cyclomatic Complexity from 6.1 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity3.8 / 10Weak✓ 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 3.8 / 10 · rule-coverage 100% · ceiling Prevented

289 method(s) exceeded the cognitive complexity threshold of 15; the worst was LoroDoc.#importBlob at 145.

loro_internal::dag::_find_meet_and_mode (cognitive 123) · ×36crates/loro-internal/src/dag.rs:710
DocState::apply_diff (cognitive 70) · ×13crates/loro-internal/src/state.rs:664
LoroDoc::check_apply_diff_creates_no_unknown_container (cognitive 122) · ×11crates/loro-internal/src/loro.rs:2369
RichtextState::apply_diff (cognitive 127) · ×7crates/loro-internal/src/state/richtext_state.rs:615
BTree::handle_lack_single_layer (cognitive 69) · ×7crates/generic-btree/src/lib.rs:2004

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

What to do

  1. Bring the 5 bodies over 120 down to 120 or less in Cognitive Complexity — start with LoroDoc.#importBlob (cognitive 145), RichtextState::apply_diff (cognitive 127), loro_internal::dag::_find_meet_and_mode (cognitive 123). — 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 5 together lifts Cognitive Complexity from 3.8 to about 4.1/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

142 god class(es) detected.

FileTooLong: REDACTED · ×44REDACTED
MethodTooLong: LoroDoc.#applyVersionTransition · ×34REDACTED:5836
TooManyMethods: LoroDoc · ×30REDACTED:278
ClassTooLong: LoroDoc · ×20REDACTED:278
FunctionTooLong: loro_internal::dag::_find_meet_and_mode · ×14crates/loro-internal/src/dag.rs:710

What to do

  1. Resolve the 44 FileTooLong finding(s) in God Classes — start with lib.rs (4), value.rs (3), richtext_state.rs (2). — One of this dimension's main actionable groups (44 warning-level).
  2. Resolve the 34 MethodTooLong finding(s) in God Classes — start with REDACTED (10), loro.rs (5), diff_calc.rs (5). — One of this dimension's main actionable groups (34 warning-level).
  3. Resolve the 30 TooManyMethods finding(s) in God Classes — start with lib.rs (7), containers.ts (3), richtext_state.rs (2). — One of this dimension's main actionable groups (30 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.4 / 10Stronggated by 181 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

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

174 duplicated block group(s) detected. A further 7 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 35 of the 181 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .ts (21% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.

Duplicated block (9 lines × 2) · ×19crates/fuzz/src/crdt_fuzzer.rs:964
Duplicated block (5 lines × 2) · ×16crates/dev-utils/src/lib.rs:82
Duplicated block (8 lines × 2) · ×15crates/generic-btree/src/lib.rs:2091
Duplicated block (6 lines × 2) · ×11crates/loro-internal/src/diff_calc.rs:1015
Duplicated block (11 lines × 2) · ×10crates/kv-store/src/sstable.rs:931

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

What to do

  1. Resolve the 19 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with handler.rs (4), crdt_fuzzer.rs (3), lib.rs. — One of this dimension's main actionable groups (19 warning-level).
  2. Resolve the 16 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with value.rs (3), block_encode.rs (2), lib.rs. — One of this dimension's main actionable groups (16 warning-level).
  3. Resolve the 15 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with handler.rs (5), style_range_map.rs (3), lib.rs. — One of this dimension's main actionable groups (15 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling8.7 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

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

20 production modules (Cargo+npm+Deno), 0 dependency cycle(s), 1 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence, with abstractness counted on 16 of the 20 (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: loro_fractional_index · ×2
Unstable project loro (Cargo)

What to do

  1. Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 Unstable project loro (Cargo) finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D6 · Cohesion (LCOM4)9.8 / 10Stronggated by 3 serious findings✓ 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 9.8 / 10 · rule-coverage 100% · ceiling Verified

3 of 216 classes have LCOM4 above 3.

Low cohesion: LoroDoc (LCOM4 27) · ×3crates/loro-internal/src/lib.rs:126

What to do

  1. Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with lib.rs, version.rs, value.rs. — One of this dimension's main actionable groups (3 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

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

2902 test methods: 1577 unit, 1325 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 926 `it`/`test` case(s) across 96 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 1976 `#[test]` function(s) across 269 file(s) declaring at least one; its unit/integration split is Cargo's own — 167 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality9.6 / 10Stronggated by 25 serious findings✓ Tool-verified

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

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

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

13 skipped (11 with a documented reason), 23 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 926 tests. Measured on the JavaScript/TypeScript suite only — at least 248 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: importBatch Error #181 · ×23crates/loro-wasm/tests/basic.test.ts:261
Skipped test: subscription works after timeout · ×2crates/loro-wasm/tests/event.test.ts:631
Skipped (documented): (unnamed test) · ×11loro-js/tests/legacy-data.test.ts:104

What to do

  1. Resolve the 23 No assertions finding(s) in Test Quality — start with basic.test.ts (6), type.test.ts (6), misc.test.ts (4). — One of this dimension's main actionable groups (23 warning-level).
  2. Resolve the 2 Skipped test finding(s) in Test Quality — start with event.test.ts, misc.test.ts. — One of this dimension's main actionable groups (2 warning-level).
  3. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D12 · Dependency Hygiene8.4 7.9 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 7.9 / 10 · rule-coverage 94% · ceiling Verified

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

Yanked release: lz4_flex
Outdated: anyhow · ×22

What to do

  1. Resolve the 1 Yanked release finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).
  2. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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 314 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 14 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. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares REDACTED, 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: REDACTED (23×100=2300); crates/loro-internal/src/loro.rs (21×48=1008); crates/loro-internal/src/state.rs (15×37=555) Repeated repair below the complexity floor: crates/loro/src/lib.rs (6 of 11 changes were fixes); crates/loro-internal/src/oplog/pending_changes.rs (6 of 7 changes were fixes); crates/loro-internal/src/arena.rs (6 of 7 changes were fixes)

Hotspot: REDACTED · ×18REDACTED:5836
Repeated repair: crates/loro/src/lib.rs · ×16crates/loro/src/lib.rs:4070

What to do

  1. Resolve the 18 Hotspot finding(s) in Churn × Complexity Hotspots — start with richtext_state.rs (2), REDACTED, loro.rs. — One of this dimension's main actionable groups (18 warning-level).
  2. Resolve the 16 Repeated repair finding(s) in Churn × Complexity Hotspots — start with tree.rs (2), lib.rs, pending_changes.rs. — One of this dimension's main actionable groups (16 warning-level).

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

D17 · Explicit Debt9.9 / 10Stronggated by 95 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

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

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

TodoComment · ×89examples/loro-quill/src/binding.ts:164
FixmeComment · ×6crates/loro-internal/src/loro.rs:1724

What to do

  1. Resolve the 89 TodoComment finding(s) in Explicit Debt — start with lib.rs (10), diff_calc.rs (8), richtext_state.rs (7). — One of this dimension's main actionable groups (89 warning-level).
  2. Resolve the 6 FixmeComment finding(s) in Explicit Debt — start with loro.rs, oplog.rs, container_wrapper.rs. — One of this dimension's main actionable groups (6 warning-level).
  3. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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. 26 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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — 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 Cohesion7.6 / 10Strong✓ 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, LLM-independent.

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

2 of 17 build units (Cargo, Deno, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

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

D28 · Secrets (history)8.0 / 10Adequategated by 2 critical findings✓ 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 8.0 / 10 · rule-coverage 100% · ceiling Documented

2 finding(s): 0 critical, 2 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 2 REDACTED finding(s) in Secrets (history) — start with REDACTED (2). — One of this dimension's main actionable groups (2 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)1.4 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

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

45 finding(s): 0 critical, 40 high, 5 medium, 0 low. 30 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) — `crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs` (line 239), `crates/loro-internal/src/op.rs` (line 296), `crates/loro-wasm/index.ts` (line 2), `crates/loro-wasm/src/lib.rs` (line 312, line 314, line 316, …), `loro-js/src/runtime/containers.ts` (line 2834), … (+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. Separately, one or more rules could not re-parse an embedded snippet in 3 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

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

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

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

92 finding(s): 4 critical, 36 high, 51 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 35 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (31), REDACTED (3), REDACTED. — One of this dimension's main actionable groups (35 issue-level).
  2. Resolve the 4 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 1 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

D31 · IaC & Container Security6.9 / 10Adequate✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

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

12 finding(s): 0 critical, 8 high, 4 medium, 0 low.

REDACTED
REDACTED

What to do

  1. Resolve the 8 High IaC finding(s) in IaC & Container Security — start with REDACTED (8). — One of this dimension's main actionable groups (8 issue-level).
  2. Resolve the 4 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).

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

D34 · Knowledge Freshness9.7 / 10Adequategated by 1 critical finding✓ 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 9.7 / 10 · rule-coverage 100% · ceiling Documented

5 of 196 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/loro-internal/src/jsonpath/parser.rs. Counted over 196 of the 265 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgecrates/loro-internal/src/jsonpath/parser.rs:1
Orphaned file · ×4crates/loro-internal/src/jsonpath/ast.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with parser.rs. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 4 Orphaned file finding(s) in Knowledge Freshness — start with ast.rs, dfs.rs, bfs.rs. — One of this dimension's main actionable groups (4 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.8 / 10Stronggated by 3 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

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

Strongest change-coupling: style_range_map.rs↔handler.rs 75%; list_state.rs↔map_state.rs 51%; kv_store.rs↔oplog.rs 50%

Change coupling: style_range_map.rs ↔ handler.rs · ×3crates/loro-internal/src/container/richtext/style_range_map.rs:1

What to do

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

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

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

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

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored 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. SCORED, not informational.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition10.0 / 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.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
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.

AX6 · Interface segregation9.5 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `DocLike` declares 26 required operations: `setPeerId`, `getMovableList`, `getMap`, `getContainerById`, `commit`, `getPendingTxnLength`, `export`, `import`, `importBatch`, `toJSON`, `getShallowValue`, `oplogVersion`, `frontiers`, `oplogFrontiers`, `checkout`, `checkoutToLatest`, `isDetached`, `revertTo`, `diff`, `subscribe`, `isShallow`, `shallowSinceVV`, `getCursorPos`, `getPathToContainer`, `forkAt`, `fork`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — loro-js/tests/differential/engine.ts:70
  • `FractionalIndexNamespace` declares 16 required operations: `default`, `fromHexString`, `new`, `newBefore`, `newAfter`, `newBetween`, `generateNEvenly`, `jitterDefault`, `newJitter`, `newBeforeJitter`, `newAfterJitter`, `newBetweenJitter`, `generateNEvenlyJitter`, `compare`, `equals`, `isFractionalIndex`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/fractional-index/src/index.ts:20

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

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.

M1 · Documentation (README)6.8 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 16 of 27 project(s) that lack one — worth up to 1.2 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ 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 repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy6.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

  • crates/loro/README.md links to `struct.LoroDoc.html`, but `crates/loro/struct.LoroDoc.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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. — crates/loro/README.md:60
  • crates/loro/README.md links to `trait.ToJson.html`, but `crates/loro/trait.ToJson.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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. — crates/loro/README.md:80

What to do

  • Reconcile the README with reality: crates/loro/README.md links to `struct.LoroDoc.html`, but `crates/loro/struct.LoroDoc.html` does not exist; crates/loro/README.md links to `trait.ToJson.html`, but `crates/loro/trait.ToJson.html` 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 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.5 / 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 9/11 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `crates/loro-wasm-tools`.

What to do

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

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 & Rollback5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

What to do

  • Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where Watchdog can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

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

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene6.0 / 10Adequate✓ 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 the language 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.

  • `existsSync` in `findEntrypoint` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — examples/bundler-smoke-tests/scripts/browser-runtime.mjs:64
  • `existsSync` in `callback to createServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — examples/bundler-smoke-tests/scripts/browser-runtime.mjs:91, examples/bundler-smoke-tests/scripts/browser-runtime.mjs:114
  • `existsSync` in `runCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — examples/bundler-smoke-tests/scripts/browser-runtime.mjs:293, examples/bundler-smoke-tests/scripts/dev-runtime.mjs:232

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety9.1 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication8.2 / 10Strong✓ Tool-verified

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

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

  • loro-js/src/runtime/sequence-index.ts:3658 · loro-js/src/runtime/sequence-index.ts:3714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:3658
  • packages/fractional-index/src/index.ts:135 · packages/fractional-index/src/index.ts:237 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/fractional-index/src/index.ts:135
  • loro-js/src/runtime/sequence-index.ts:2866 · loro-js/src/runtime/sequence-index.ts:2981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:2866
  • loro-js/src/codec/change-value.ts:347 · loro-js/src/codec/value.ts:31 — the two spans are one implementation copied and then locally edited — 220 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/codec/change-value.ts:347
  • loro-js/src/codec/container-id.ts:23 · loro-js/src/codec/container-id.ts:62 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/container-id.ts:23
  • loro-js/src/codec/serde-columnar.ts:398 · loro-js/src/codec/serde-columnar.ts:452 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/serde-columnar.ts:398
  • loro-js/src/runtime/sequence-index.ts:1075 · loro-js/src/runtime/sequence-index.ts:1163 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/runtime/sequence-index.ts:1075
  • loro-js/src/runtime/sequence-deletion-index.ts:238 · loro-js/src/runtime/sequence-index.ts:3321 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — loro-js/src/runtime/sequence-deletion-index.ts:238
  • loro-js/src/codec/value.ts:134 · loro-js/src/codec/version.ts:9 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/value.ts:134
  • loro-js/src/runtime/sequence-deletion-index.ts:169 · loro-js/src/runtime/text-style-index.ts:332 — the two spans are one implementation copied and then locally edited — 236 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/runtime/sequence-deletion-index.ts:169
  • loro-js/src/runtime/sequence-index.ts:1530 · loro-js/src/runtime/sequence-index.ts:1557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:1530
  • loro-js/src/runtime/sequence-index.ts:2281 · loro-js/src/runtime/sequence-index.ts:2921 · loro-js/src/runtime/sequence-index.ts:3036 — 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. — loro-js/src/runtime/sequence-index.ts:2281
  • loro-js/src/runtime/sequence-index.ts:2128 · loro-js/src/runtime/sequence-index.ts:2202 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/runtime/sequence-index.ts:2128
  • loro-js/src/codec/value.ts:26 · loro-js/src/codec/value.ts:131 — the two spans are one implementation copied and then locally edited — 144 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/codec/value.ts:26
  • REDACTED:10971 · loro-js/src/runtime/sequence-index.ts:3540 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — REDACTED:10971
  • loro-js/src/runtime/ephemeral.ts:379 · loro-js/src/runtime/ephemeral.ts:401 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/runtime/ephemeral.ts:379
  • loro-js/src/runtime/ordered-index.ts:241 · loro-js/src/runtime/sequence-index.ts:2020 — the two spans are one implementation copied and then locally edited — 120 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/runtime/ordered-index.ts:241
  • loro-js/src/runtime/sequence-index.ts:2084 · loro-js/src/runtime/sequence-index.ts:2145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:2084
  • loro-js/src/runtime/sequence-index.ts:4023 · loro-js/src/runtime/sequence-index.ts:4042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:4023
  • loro-js/src/codec/container-id.ts:37 · loro-js/src/codec/container-id.ts:76 · loro-js/src/runtime/ids.ts:77 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/container-id.ts:37
  • REDACTED:5949 · REDACTED:5985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:5949
  • loro-js/src/runtime/sequence-index.ts:232 · loro-js/src/runtime/sequence-index.ts:525 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/runtime/sequence-index.ts:232
  • loro-js/src/codec/serde-columnar.ts:370 · loro-js/src/codec/serde-columnar.ts:431 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/serde-columnar.ts:370
  • REDACTED:10816 · REDACTED:11333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:10816
  • loro-js/src/runtime/sequence-index.ts:736 · loro-js/src/runtime/sequence-index.ts:840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:736
  • loro-js/src/codec/sstable.ts:550 · loro-js/src/codec/sstable.ts:565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/codec/sstable.ts:550
  • REDACTED:4849 · REDACTED:4869 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:4849
  • REDACTED:6622 · REDACTED:6725 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:6622
  • REDACTED:10609 · REDACTED:10644 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:10609
  • REDACTED:10943 · loro-js/src/runtime/movable-list.ts:159 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:10943
  • loro-js/src/runtime/movable-list.ts:566 · loro-js/src/runtime/movable-list.ts:682 — the two spans are one implementation copied and then locally edited — 93 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/runtime/movable-list.ts:566
  • loro-js/src/runtime/undo.ts:261 · loro-js/src/runtime/undo.ts:319 — the two spans are one implementation copied and then locally edited — 129 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/runtime/undo.ts:261
  • loro-js/src/codec/bytes.ts:190 · loro-js/src/codec/lz4.ts:314 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — loro-js/src/codec/bytes.ts:190
  • loro-js/src/codec/change-block-codec.ts:379 · loro-js/src/codec/change-block-codec.ts:437 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — loro-js/src/codec/change-block-codec.ts:379
  • loro-js/src/codec/leb128.ts:49 · loro-js/src/codec/serde-columnar.ts:584 — the two spans are one implementation copied and then locally edited — 65 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — loro-js/src/codec/leb128.ts:49
  • REDACTED:5143 · REDACTED:10074 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:5143
  • REDACTED:8238 · REDACTED:8265 · loro-js/src/runtime/movable-list.ts:724 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:8238
  • REDACTED:9758 · REDACTED:9772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:9758
  • loro-js/src/runtime/event-diff.ts:304 · loro-js/src/runtime/sequence-index.ts:3418 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — loro-js/src/runtime/event-diff.ts:304
  • loro-js/src/runtime/sequence-index.ts:709 · loro-js/src/runtime/sequence-index.ts:979 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — loro-js/src/runtime/sequence-index.ts:709

What to do

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

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

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

  • (anonymous) has cyclomatic complexity 42 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:5891
  • concreteOp has cyclomatic complexity 40 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/fuzz/differential.ts:991
  • jsonOperationToDecoded has cyclomatic complexity 37 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:10197
  • transition has cyclomatic complexity 34 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/movable-list.ts:540
  • generateAction has cyclomatic complexity 32 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/differential/fuzz.ts:245
  • recomputeOwnElements has cyclomatic complexity 31 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:2947
  • decodeImportBlobMeta has cyclomatic complexity 31 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:8895
  • applySelector has cyclomatic complexity 30 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/jsonpath.ts:281
  • insertSpanAtPhysical has cyclomatic complexity 29 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:1104
  • apply has cyclomatic complexity 29 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/differential/fuzz.ts:405
  • recomputeOwn has cyclomatic complexity 28 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:2834
  • generateActions has cyclomatic complexity 28 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/support/richtext-differential.ts:189
  • encodeChangeValueContent has cyclomatic complexity 28 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/codec/change-value.ts:212
  • apply has cyclomatic complexity 27 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/movable-list-undo.ts:73
  • primitiveCompare has cyclomatic complexity 27 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/jsonpath.ts:766
  • insertAtPhysical has cyclomatic complexity 26 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:1025
  • decodeOperationContent has cyclomatic complexity 25 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/codec/change-block-codec.ts:358
  • #record has cyclomatic complexity 25 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/undo.ts:239
  • #apply has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/support/richtext-differential.ts:349
  • equivalentEvents has cyclomatic complexity 24 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/differential/harness.ts:484

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files0.4 / 10Critical✓ Tool-verified

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

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

  • REDACTED has 11099 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • loro-js/src/runtime/sequence-index.ts has 4095 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/sequence-index.ts:1
  • loro-js/src/runtime/containers.ts has 3721 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/containers.ts:1
  • loro-js/src/runtime/movable-list.ts has 997 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/movable-list.ts:1
  • loro-js/src/codec/state-snapshot.ts has 979 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/state-snapshot.ts:1
  • loro-js/src/runtime/jsonpath.ts has 859 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/jsonpath.ts:1
  • loro-js/src/codec/change-block-codec.ts has 797 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/change-block-codec.ts:1
  • loro-js/src/codec/serde-columnar.ts has 700 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/serde-columnar.ts:1
  • loro-js/src/codec/sstable.ts has 553 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/sstable.ts:1
  • loro-js/src/runtime/ephemeral.ts has 529 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/ephemeral.ts:1
  • packages/fractional-index/src/index.ts has 498 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/fractional-index/src/index.ts:1
  • loro-js/src/codec/change-value.ts has 469 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/change-value.ts:1
  • loro-js/src/runtime/text-style-index.ts has 467 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/runtime/text-style-index.ts:1
  • crates/loro-wasm/index.ts has 461 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/loro-wasm/index.ts:1
  • loro-js/src/codec/change-block-tables.ts has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — loro-js/src/codec/change-block-tables.ts:1
  • crates/loro-wasm/scripts/build.ts has 434 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — crates/loro-wasm/scripts/build.ts:1

What to do

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

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

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

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×20) — crates/loro-wasm/scripts/build.ts:1, crates/loro-wasm/scripts/measure-snapshot-round-memory.cjs:1, loro-js/scripts/rewrite-rust-fixture.mjs:1, …

What to do

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

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

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

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

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

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

  • Unreachable from the 25 application, 10 tooling and 109 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (25 application, 10 tooling, 109 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×4) — scripts/run-js-doc-tests.ts, REDACTED, crates/loro-internal/scripts/fuzz.ts, …
  • no import path from any entry point (25 application, 10 tooling, 109 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (crates/loro-internal/scripts/run_mem.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — crates/loro-internal/scripts/mem.ts
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×2) — crates/loro-wasm/index.ts:467, crates/loro-wasm/tests/issue.test.ts:90

What to do

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

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

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

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

What to do

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

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

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

  • loro-js/src/runtime/containers.ts → loro-js/src/runtime/movable-list.ts → loro-js/src/runtime/containers.ts — loro-js/src/runtime/containers.ts:11

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.
S1 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository serves no HTTP of its own — no HTTP-server crate (actix-web, axum, Rocket, warp, poem, tide, salvo, tonic, a hyper server, …) among its Cargo manifests' run-time dependencies, and no server started in its production source — so HTTPS enforcement, HSTS, cookie flags and input validation are N/A here, as they are for a C# library or worker.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. — crates/loro-internal/src/encoding.rs:315

What to do

  • Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key.
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 branch10.0 / 10Exemplary○ Nothing flagged

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.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. 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 `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

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 document10.0 / 10Exemplary○ Nothing flagged

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.

X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

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.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. 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 `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

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.

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.

X3 · Exception handling5.4 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×3) — crates/loro-wasm/scripts/build.ts:224, crates/loro-wasm/scripts/container_id_cache_patch.js:39, crates/loro-wasm/scripts/container_id_cache_patch.js:51
  • `catch (_err)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — crates/loro-wasm/scripts/build.ts:400

What to do

  • Swallowed exception (empty catch)
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.

X4 · Structured logging3.9 / 10Weak✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `REDACTED` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `info!` at line 476 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/arena.rs:476
  • `info!` at line 489 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/arena.rs:489
  • `info!` at line 496 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/arena.rs:496
  • `error!` at line 2364 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/handler.rs:2364
  • `error!` at line 3314 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/loro.rs:3314
  • `warn!` at line 4104 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/loro.rs:4104
  • `warn!` at line 758 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/state.rs:758
  • `error!` at line 369 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/state/movable_list_state.rs:369
  • `error!` at line 374 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/state/movable_list_state.rs:374
  • `info!` at line 125 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:125
  • `info!` at line 126 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:126
  • `info!` at line 127 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:127
  • `info!` at line 128 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:128
  • `info!` at line 129 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:129
  • `info!` at line 130 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:130
  • `info!` at line 131 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:131
  • `info!` at line 132 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro-internal/src/oplog/change_store/block_encode.rs:132
  • `info!` at line 3708 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/loro/src/lib.rs:3708

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types6.0 / 10Adequate✓ Tool-verified

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

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

  • ~16.0 `!` null assertions per 1k TypeScript source lines — 549 assertion(s) across the 34404 source line(s) of the 51 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: REDACTED (168), loro-js/src/runtime/sequence-index.ts (81), loro-js/src/runtime/containers.ts (63). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

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

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 Health46%Weak — gated by D2, R3, X4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture92%ExemplaryStrongest area.
Maturity67%AdequateAcceptable, with room to improve.
Readiness68%AdequateAcceptable, with room to improve.
Security64%Adequate — gated by D29, D30, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance71%StrongSolid.
Unscored — 1 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 — 20 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for

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

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 56 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.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — 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
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
  • 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 — Naming consistency is measured on C# only; JavaScript, Python, Rust, TypeScript not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (fuzz), 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# and Visual Basic comments only — this repository's production source is .py, .rs, .ts, .tsx, 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.
  • D32 Data Compliance (PII/GDPR) — 4 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — crates/loro-wasm/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
  • 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); 49 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)
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, 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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb. TypeScript/JavaScript runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — uses a yarn lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X7 Silent fallback defaults — 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 — 92 finding(s)
D30 · Dependency Vulnerabilities · High CVE · ×35
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 10 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 5 more in this group — see findings.md.
D31 · IaC & Container Security · High IaC · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge crates/loro-internal/src/jsonpath/parser.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
R9 · Circular Imports · Import cycle (2 files) · ×1
  • Import cycle (2 files) loro-js/src/runtime/containers.ts:11 — loro-js/src/runtime/containers.ts → loro-js/src/runtime/movable-list.ts → loro-js/src/runtime/containers.ts
Serious — 1095 finding(s)
D17 · Explicit Debt · TodoComment · ×89
  • TodoComment examples/loro-quill/src/binding.ts:164 — // TODO: unobserve — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-wasm/src/lib.rs:2011 — // TODO: convert event and event sub config — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-wasm/src/lib.rs:4911 — // TODO: avoid converting — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-wasm/src/lib.rs:5281 — // TODO: perf — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-wasm/src/lib.rs:6323 — // TODO: PERF: avoid this clone — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-wasm/scripts/build.ts:228 — // TODO: polyfill FinalizationRegistry — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/arena.rs:530 — // TODO: PERF: we can speed this up by use a special bit in ContainerIdx to indicate — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/arena.rs:804 — // TODO: this can return a u16 directly now, since the depths are always valid — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/change.rs:202 — // TODO: feels slow, need to confirm whether this affects performance — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/container.rs:22 — /// TODO: make this type private in this crate only — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/container.rs:29 — // TODO: PERF: use NonZeroU32 to save memory — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/dag.rs:151 — // TODO: perf: make it also return the spans to reach the replay base — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:59 — /// TODO: persist diffCalculator and skip processed version — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:470 — // TODO: we may remove depth info — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:1220 — /// TODO: Refactor, this can be simplified — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:2207 — // TODO: PERF: Provide the lamport of to version — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:2212 — // TODO: PERF: Provide the lamport of to version — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:2216 — // TODO: PERF: Provide the lamport of to version — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:2218 — // TODO: PERF: Provide the lamport of to version — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/diff_calc.rs:2232 — // TODO: PERF: can be filtered based on the list_diff and whether the pos/value are updated — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/encoding.rs:286 — // TODO: PERF: should we use hashmap to filter latest_ids with the same peer first? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/handler.rs:2497 — // TODO: describe this behavior in the document — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/handler.rs:2667 — // TODO: implement — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/history_cache.rs:410 — // TODO: FIXME: This could be super slow in some cases — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/loro-internal/src/lib.rs:90 — // TODO: rename as Key? — 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.
  • + 64 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×44
  • FileTooLong: REDACTED REDACTED — FileTooLong — 8450 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: LoroDoc (278-8852). The bar is 500 significant lines; this is 7950 over it, 16.90× 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: runtime/sequence-index.ts loro-js/src/runtime/sequence-index.ts — FileTooLong — 3364 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2864 over it, 6.73× 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/handler.rs crates/loro-internal/src/handler.rs — FileTooLong — 3305 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 2805 over it, 6.61× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs crates/loro-wasm/src/lib.rs — FileTooLong — 3204 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 2704 over it, 6.41× 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: runtime/containers.ts loro-js/src/runtime/containers.ts — FileTooLong — 2845 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2345 over it, 5.69× 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/loro.rs crates/loro-internal/src/loro.rs — FileTooLong — 2541 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 87% of them inside a single declaration: LoroDoc (3 blocks, 95-3936). The bar is 500 significant lines; this is 2041 over it, 5.08× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: richtext/richtext_state.rs crates/loro-internal/src/container/richtext/richtext_state.rs — FileTooLong — 2017 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 1517 over it, 4.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: src/lib.rs crates/generic-btree/src/lib.rs — FileTooLong — 1945 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 86% of them inside a single declaration: BTree (7 blocks, 62-2993). The bar is 500 significant lines; this is 1445 over it, 3.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/state.rs crates/loro-internal/src/state.rs — FileTooLong — 1735 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 81% of them inside a single declaration: DocState (3 blocks, 159-2774). The bar is 500 significant lines; this is 1235 over it, 3.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: oplog/change_store.rs crates/loro-internal/src/oplog/change_store.rs — FileTooLong — 1534 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 1034 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/diff_calc.rs crates/loro-internal/src/diff_calc.rs — FileTooLong — 1460 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 960 over it, 2.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/lib.rs crates/loro/src/lib.rs — FileTooLong — 1309 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 809 over it, 2.62× 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: state/tree_state.rs crates/loro-internal/src/state/tree_state.rs — FileTooLong — 1293 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 793 over it, 2.59× 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: encoding/json_schema.rs crates/loro-internal/src/encoding/json_schema.rs — FileTooLong — 1288 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 788 over it, 2.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: state/movable_list_state.rs crates/loro-internal/src/state/movable_list_state.rs — FileTooLong — 1170 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 670 over it, 2.34× 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: state/richtext_state.rs crates/loro-internal/src/state/richtext_state.rs — FileTooLong — 1063 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 62% of them inside a single declaration: RichtextState (5 blocks, 31-1124). The bar is 500 significant lines; this is 563 over it, 2.13× 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/oplog.rs crates/loro-internal/src/oplog.rs — FileTooLong — 992 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: OpLog (3 blocks, 51-1579). The bar is 500 significant lines; this is 492 over it, 1.98× 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: oplog/loro_dag.rs crates/loro-internal/src/oplog/loro_dag.rs — FileTooLong — 899 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 84% of them inside a single declaration: AppDag (4 blocks, 28-1443). The bar is 500 significant lines; this is 399 over it, 1.80× 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: encoding/value.rs crates/loro-internal/src/encoding/value.rs — FileTooLong — 893 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 393 over it, 1.79× 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: codec/state-snapshot.ts loro-js/src/codec/state-snapshot.ts — FileTooLong — 806 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 306 over it, 1.61× 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/txn.rs crates/loro-internal/src/txn.rs — FileTooLong — 791 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 291 over it, 1.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: handler/tree.rs crates/loro-internal/src/handler/tree.rs — FileTooLong — 779 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 83% of them inside a single declaration: TreeHandler (4 blocks, 25-1197). The bar is 500 significant lines; this is 279 over it, 1.56× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/lib.rs crates/loro-common/src/lib.rs — FileTooLong — 773 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 273 over it, 1.55× 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: runtime/movable-list.ts loro-js/src/runtime/movable-list.ts — FileTooLong — 726 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: MovableListState (184-1008). The bar is 500 significant lines; this is 226 over it, 1.45× 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/value.rs crates/loro-common/src/value.rs — FileTooLong — 709 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 209 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 19 more in this group — see findings.md.
D2 · Cognitive Complexity · loro_internal · ×36
  • loro_internal::dag::_find_meet_and_mode (cognitive 123) crates/loro-internal/src/dag.rs:710 — loro_internal::dag::_find_meet_and_mode has cognitive complexity 123 (threshold 15). Drivers by points: if/else 75 (147 pts), loops 19 (34 pts), boolean chains 10 (nesting depth added 87). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (loro_internal::dag::_find_meet_and_mode::all_tips_covered_by_ancestors, loro_internal::dag::_find_meet_and_mode::new_region_after_all_left_heads) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • loro_internal::encoding::json_schema::encode_change (cognitive 98) crates/loro-internal/src/encoding/json_schema.rs:291 — loro_internal::encoding::json_schema::encode_change has cognitive complexity 98 (threshold 15). Drivers by points: if/else 17 (61 pts), match/switch 11 (36 pts), loops 1 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::dag::_walk_to_meet (cognitive 78) crates/loro-internal/src/dag.rs:427 — loro_internal::dag::_walk_to_meet has cognitive complexity 78 (threshold 15). Drivers by points: if/else 21 (58 pts), match/switch 5 (10 pts), loops 5 (7 pts), boolean chains 3 (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.
  • loro_internal::encoding::json_schema::decode_op (cognitive 76) crates/loro-internal/src/encoding/json_schema.rs:780 — loro_internal::encoding::json_schema::decode_op has cognitive complexity 76 (threshold 15). Drivers by points: match/switch 15 (35 pts), if/else 8 (33 pts), loops 2 (8 pts) (nesting depth added 51). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • loro_internal::jsonpath::jsonpath_impl::apply_selectors (cognitive 60) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:79 — loro_internal::jsonpath::jsonpath_impl::apply_selectors has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (49 pts), loops 3 (9 pts), match/switch 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::diff::diff_impl::dj_diff (cognitive 56) crates/loro-internal/src/diff/diff_impl.rs:361 — loro_internal::diff::diff_impl::dj_diff has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (46 pts), boolean chains 4, loops 3, match/switch 2 (3 pts) (nesting depth added 26). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • loro_internal::diff::diff_impl::find_middle_snake (cognitive 47) crates/loro-internal/src/diff/diff_impl.rs:182 — loro_internal::diff::diff_impl::find_middle_snake has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (34 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 24). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner (cognitive 45) crates/loro-internal/src/encoding/shallow_snapshot.rs:301 — loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 3 (8 pts), match/switch 1 (4 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.
  • loro_internal::txn::change_to_diff (cognitive 41) crates/loro-internal/src/txn.rs:920 — loro_internal::txn::change_to_diff has cognitive complexity 41 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 6 (15 pts), match/switch 2 (7 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::loro::isolated_scalar_root_batch (cognitive 33) crates/loro-internal/src/loro.rs:3705 — loro_internal::loro::isolated_scalar_root_batch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::dag::latest_single_head_critical_version (cognitive 30) crates/loro-internal/src/dag.rs:633 — loro_internal::dag::latest_single_head_critical_version has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), match/switch 1 (2 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.
  • loro_internal::state::trigger_on_new_container (cognitive 29) crates/loro-internal/src/state.rs:2798 — loro_internal::state::trigger_on_new_container has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 4 (10 pts), match/switch 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.
  • loro_internal::state::richtext_state::snapshot::redact_dead_style_values (cognitive 28) crates/loro-internal/src/state/richtext_state.rs:1391 — loro_internal::state::richtext_state::snapshot::redact_dead_style_values has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::undo::movable_list::prepare (cognitive 28) crates/loro-internal/src/undo/movable_list.rs:590 — loro_internal::undo::movable_list::prepare has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (10 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::container::richtext::richtext_state::pos_type_offset_to_entity_offset (cognitive 27) crates/loro-internal/src/container/richtext/richtext_state.rs:3002 — loro_internal::container::richtext::richtext_state::pos_type_offset_to_entity_offset has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 4 (7 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • loro_internal::encoding::json_schema::json::redact_op (cognitive 26) crates/loro-internal/src/encoding/json_schema.rs:1791 — loro_internal::encoding::json_schema::json::redact_op has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 6 (11 pts), loops 3 (9 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • loro_internal::encoding::outdated_encode_reordered::decode_op (cognitive 26) crates/loro-internal/src/encoding/outdated_encode_reordered.rs:288 — loro_internal::encoding::outdated_encode_reordered::decode_op has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 7 (13 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.
  • loro_internal::undo::movable_list::complete_anchors (cognitive 26) crates/loro-internal/src/undo/movable_list.rs:278 — loro_internal::undo::movable_list::complete_anchors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (11 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::dag::_find_meet_and_mode::new_region_after_all_left_heads (cognitive 25) crates/loro-internal/src/dag.rs:912 — loro_internal::dag::_find_meet_and_mode::new_region_after_all_left_heads has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (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. This shape REPEATS in the file: 2 other methods here (loro_internal::dag::_find_meet_and_mode, loro_internal::dag::_find_meet_and_mode::all_tips_covered_by_ancestors) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • loro_internal::undo::movable_list::scopes (cognitive 25) crates/loro-internal/src/undo/movable_list.rs:56 — loro_internal::undo::movable_list::scopes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (8 pts), match/switch 2 (6 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.
  • loro_internal::encoding::shallow_snapshot::estimate_ops_content_bytes (cognitive 24) crates/loro-internal/src/encoding/shallow_snapshot.rs:72 — loro_internal::encoding::shallow_snapshot::estimate_ops_content_bytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • loro_internal::encoding::json_schema::validate_json_op_created_container_ids (cognitive 22) crates/loro-internal/src/encoding/json_schema.rs:672 — loro_internal::encoding::json_schema::validate_json_op_created_container_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • loro_internal::dag::mermaid::to_str (cognitive 21) crates/loro-internal/src/dag/mermaid.rs:21 — loro_internal::dag::mermaid::to_str has cognitive complexity 21 (threshold 15). Drivers by points: loops 10 (18 pts), if/else 1 (3 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • loro_internal::jsonpath::jsonpath_impl::eval_function (cognitive 21) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:261 — loro_internal::jsonpath::jsonpath_impl::eval_function has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 3 (8 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.
  • loro_internal::oplog::change_store::block_encode::decode_block (cognitive 21) crates/loro-internal/src/oplog/change_store/block_encode.rs:608 — loro_internal::oplog::change_store::block_encode::decode_block has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (4 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.
  • + 11 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×34
  • MethodTooLong: LoroDoc.#applyVersionTransition REDACTED:5836 — MethodTooLong — #applyVersionTransition runs 334 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 234 over it, 3.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.#importBlob REDACTED:792 — MethodTooLong — #importBlob runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.undo_internal_with crates/loro-internal/src/loro.rs:1452 — MethodTooLong — undo_internal_with runs 186 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 86 over it, 1.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.
  • MethodTooLong: LoroDoc.#containerState REDACTED:8234 — MethodTooLong — #containerState runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.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.
  • MethodTooLong: DiffCalculator.try_calc_diff_internal crates/loro-internal/src/diff_calc.rs:186 — MethodTooLong — try_calc_diff_internal runs 176 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 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MovableListState.decode_snapshot_fast crates/loro-internal/src/state/movable_list_state.rs:1622 — MethodTooLong — decode_snapshot_fast runs 176 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 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.diff REDACTED:1263 — MethodTooLong — diff runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.#applyOperation REDACTED:5167 — MethodTooLong — #applyOperation runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.import_changes_and_apply_delta_to_state_if_needed crates/loro-internal/src/loro.rs:864 — MethodTooLong — import_changes_and_apply_delta_to_state_if_needed runs 152 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RichtextState.apply_diff crates/loro-internal/src/state/richtext_state.rs:615 — MethodTooLong — apply_diff runs 147 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 47 over it, 1.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TextHandler.insert_with_txn_and_attr crates/loro-internal/src/handler.rs:2132 — MethodTooLong — insert_with_txn_and_attr runs 141 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 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DocState.get_value_by_path crates/loro-internal/src/state.rs:2575 — MethodTooLong — get_value_by_path runs 141 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 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ValueReader.recursive_read_value_type_and_content crates/loro-internal/src/encoding/value.rs:676 — MethodTooLong — recursive_read_value_type_and_content runs 138 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Handler.apply_diff crates/loro-internal/src/handler.rs:1352 — MethodTooLong — apply_diff 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: RichtextState.apply_diff_and_convert crates/loro-internal/src/state/richtext_state.rs:379 — MethodTooLong — apply_diff_and_convert runs 131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.check_apply_diff_creates_no_unknown_container crates/loro-internal/src/loro.rs:2369 — MethodTooLong — check_apply_diff_creates_no_unknown_container runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DocState.apply_diff crates/loro-internal/src/state.rs:664 — MethodTooLong — apply_diff runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoroDoc.#applyMovableListMoves REDACTED:1476 — MethodTooLong — #applyMovableListMoves 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: RichtextDiffCalculator.calculate_diff crates/loro-internal/src/diff_calc.rs:1757 — MethodTooLong — calculate_diff 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: LoroDoc.query_pos_internal crates/loro-internal/src/loro.rs:3249 — MethodTooLong — query_pos_internal 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: LoroDoc.#hydrateContainerState REDACTED:8545 — MethodTooLong — #hydrateContainerState runs 124 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RichtextDiffCalculator.apply_crdt_op_to_tracker crates/loro-internal/src/diff_calc.rs:1230 — MethodTooLong — apply_crdt_op_to_tracker 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.
  • MethodTooLong: LoroDoc.#completeTreeRevivals REDACTED:1650 — MethodTooLong — #completeTreeRevivals runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: OpLog.try_iter_from_replay_base_causally crates/loro-internal/src/oplog.rs:1142 — MethodTooLong — try_iter_from_replay_base_causally 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: RichtextState.slice_delta crates/loro-internal/src/container/richtext/richtext_state.rs:2149 — MethodTooLong — slice_delta runs 114 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 14 over it, 1.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 9 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×30
  • TooManyMethods: LoroDoc REDACTED:278 — TooManyMethods — 249 methods. The bar is 30 methods; this is 219 over it, 8.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LoroDoc crates/loro-internal/src/lib.rs:126 — TooManyMethods — 158 methods, declared across 9 files: src/loro.rs (145), src/txn.rs (5), src/fork.rs (2), src/configure.rs (1), +5 more file(s). The bar is 30 methods; this is 128 over it, 5.27× 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: LoroDoc crates/loro/src/lib.rs:118 — TooManyMethods — 111 methods. The bar is 30 methods; this is 81 over it, 3.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DocState crates/loro-internal/src/state.rs:159 — TooManyMethods — 99 methods, declared across 5 files: src/state.rs (86), state/container_tree.rs (5), state/mergeable.rs (4), src/parent.rs (2), +1 more file(s). The bar is 30 methods; this is 69 over it, 3.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: OpLog crates/loro-internal/src/oplog.rs:51 — TooManyMethods — 93 methods, declared across 5 files: src/oplog.rs (82), oplog/known_history.rs (5), oplog/pending_changes.rs (4), encoding/fast_snapshot.rs (1), +1 more file(s). The bar is 30 methods; this is 63 over it, 3.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LoroDoc crates/loro-wasm/src/lib.rs:304 — TooManyMethods — 84 methods, declared across 2 files: src/lib.rs (82), src/container_tree.rs (2). The bar is 30 methods; this is 54 over it, 2.80× 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: SequenceIndex loro-js/src/runtime/sequence-index.ts:166 — TooManyMethods — 81 methods. The bar is 30 methods; this is 51 over it, 2.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BTree crates/generic-btree/src/lib.rs:62 — 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: LoroText loro-js/src/runtime/containers.ts:1359 — TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChangeStore crates/loro-internal/src/oplog/change_store.rs:77 — TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RichtextState crates/loro-internal/src/container/richtext/richtext_state.rs:41 — 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: TextHandler crates/loro-internal/src/handler.rs:451 — TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AppDag crates/loro-internal/src/oplog/loro_dag.rs:28 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× 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: TextSequenceSpan loro-js/src/runtime/containers.ts:705 — TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MovableListHandler crates/loro-internal/src/handler.rs:788 — TooManyMethods — 44 methods, declared across 2 files: src/handler.rs (37), handler/movable_list_apply_delta.rs (7). The bar is 30 methods; this is 14 over it, 1.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TreeHandler crates/loro-internal/src/handler/tree.rs:25 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ContainerStore crates/loro-internal/src/state/container_store.rs:41 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ContainerWrapper crates/loro-internal/src/state/container_store/container_wrapper.rs:21 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SharedArena crates/loro-internal/src/arena.rs:103 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LoroTree loro-js/src/runtime/containers.ts:2829 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RichtextState crates/loro-internal/src/state/richtext_state.rs:31 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InnerStore crates/loro-internal/src/state/container_store/inner_store.rs:29 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LoroText crates/loro/src/lib.rs:2607 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Transaction crates/loro-internal/src/txn.rs:154 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× 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: LoroText crates/loro-wasm/src/lib.rs:2853 — TooManyMethods — 34 methods, declared across 2 files: src/lib.rs (33), src/container_tree.rs (1). The bar is 30 methods; this is 4 over it, 1.13× 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.
  • + 5 more in this group — see findings.md.
D10 · Test Quality · No assertions · ×23
  • No assertions: importBatch Error #181 crates/loro-wasm/tests/basic.test.ts:261 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: can use version vector multiple times crates/loro-wasm/tests/basic.test.ts:1179 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: insert counter container crates/loro-wasm/tests/basic.test.ts:1610 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: move tree nodes within the same parent crates/loro-wasm/tests/basic.test.ts:1632 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: text mark on LoroText crates/loro-wasm/tests/basic.test.ts:1751 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: update text after switching to a version crates/loro-wasm/tests/basic.test.ts:1870 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: #211 crates/loro-wasm/tests/issue.test.ts:5 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: json encoding crates/loro-wasm/tests/json.test.ts:16 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: json decoding crates/loro-wasm/tests/json.test.ts:41 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: test map type crates/loro-wasm/tests/misc.test.ts:291 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: test recursive map type crates/loro-wasm/tests/misc.test.ts:298 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: works for list type crates/loro-wasm/tests/misc.test.ts:310 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: test binary type crates/loro-wasm/tests/misc.test.ts:318 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Insert cursed str crates/loro-wasm/tests/richtext.test.ts:400 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Container should not match Value crates/loro-wasm/tests/type.test.ts:13 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: A non-numeric string is not a valid peer id crates/loro-wasm/tests/type.test.ts:18 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Expect container type crates/loro-wasm/tests/type.test.ts:25 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: doc type and container type crates/loro-wasm/tests/type.test.ts:36 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: fail on set/insert container crates/loro-wasm/tests/type.test.ts:68 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: batchImport type crates/loro-wasm/tests/type.test.ts:81 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: avoid rust recursive use error crates/loro-wasm/tests/undo.test.ts:499 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: fork when detached crates/loro-wasm/bun_tests/bun.test.ts:10 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: toJsonWithReplacer crates/loro-wasm/bun_tests/bun.test.ts:43 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D3 · God Classes · ClassTooLong · ×20
  • ClassTooLong: LoroDoc REDACTED:278 — ClassTooLong — 6230 significant lines (blank, comment-only and punctuation-only lines excluded), 249 methods. The bar is 400 significant lines; this is 5830 over it, 15.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SequenceIndex loro-js/src/runtime/sequence-index.ts:166 — ClassTooLong — 1692 significant lines (blank, comment-only and punctuation-only lines excluded), 81 methods. The bar is 400 significant lines; this is 1292 over it, 4.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BTree crates/generic-btree/src/lib.rs:62 — ClassTooLong — 1664 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, 7 blocks, lines 62-2993. The bar is 400 significant lines; this is 1264 over it, 4.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DocState crates/loro-internal/src/state.rs:159 — ClassTooLong — 1402 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 99 methods, 3 blocks, lines 159-2774. The bar is 400 significant lines; this is 1002 over it, 3.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TextHandler crates/loro-internal/src/handler.rs:451 — ClassTooLong — 1040 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 53 methods, 4 blocks, lines 451-3066. The bar is 400 significant lines; this is 640 over it, 2.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RichtextState crates/loro-internal/src/container/richtext/richtext_state.rs:41 — ClassTooLong — 1033 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 3 blocks, lines 41-2968. The bar is 400 significant lines; this is 633 over it, 2.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: OpLog crates/loro-internal/src/oplog.rs:51 — ClassTooLong — 809 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 93 methods, 3 blocks, lines 51-1579. The bar is 400 significant lines; this is 409 over it, 2.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.
  • ClassTooLong: LoroDoc crates/loro-wasm/src/lib.rs:304 — ClassTooLong — 765 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 84 methods, 4 blocks, lines 304-2741. The bar is 400 significant lines; this is 365 over it, 1.91× 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: LoroText loro-js/src/runtime/containers.ts:1359 — ClassTooLong — 756 significant lines (blank, comment-only and punctuation-only lines excluded), 68 methods. The bar is 400 significant lines; this is 356 over it, 1.89× 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: AppDag crates/loro-internal/src/oplog/loro_dag.rs:28 — ClassTooLong — 751 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 52 methods, 4 blocks, lines 28-1443. The bar is 400 significant lines; this is 351 over it, 1.88× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RichtextState crates/loro-internal/src/state/richtext_state.rs:31 — ClassTooLong — 655 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 36 methods, 5 blocks, lines 31-1124. The bar is 400 significant lines; this is 255 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TreeHandler crates/loro-internal/src/handler/tree.rs:25 — ClassTooLong — 644 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 4 blocks, lines 25-1197. The bar is 400 significant lines; this is 244 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MovableListState loro-js/src/runtime/movable-list.ts:184 — ClassTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 178 over it, 1.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RichtextDiffCalculator crates/loro-internal/src/diff_calc.rs:1082 — ClassTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods, 3 blocks, lines 1082-1983. The bar is 400 significant lines; this is 178 over it, 1.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MovableListHandler crates/loro-internal/src/handler.rs:788 — ClassTooLong — 553 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 4 blocks, lines 788-4419. The bar is 400 significant lines; this is 153 over it, 1.38× 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: TreeState crates/loro-internal/src/state/tree_state.rs:45 — ClassTooLong — 553 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 33 methods, 4 blocks, lines 45-1505. The bar is 400 significant lines; this is 153 over it, 1.38× 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: ContainerWrapper crates/loro-internal/src/state/container_store/container_wrapper.rs:21 — ClassTooLong — 461 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 2 blocks, lines 21-843. The bar is 400 significant lines; this is 61 over it, 1.15× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Tracker crates/loro-internal/src/container/richtext/tracker.rs:31 — ClassTooLong — 447 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 28 methods, 3 blocks, lines 31-726. The bar is 400 significant lines; this is 47 over it, 1.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MovableListState crates/loro-internal/src/state/movable_list_state.rs:32 — ClassTooLong — 433 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 26 methods, 4 blocks, lines 32-1471. The bar is 400 significant lines; this is 33 over it, 1.08× 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: LoroDoc crates/loro/src/lib.rs:118 — ClassTooLong — 406 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 111 methods, 4 blocks, lines 118-1926. The bar is 400 significant lines; this is 6 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.
R4 · Test Coverage · No test reaches this file · ×20
  • No test reaches this file crates/loro-wasm/scripts/build.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/measure-snapshot-round-memory.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file loro-js/scripts/rewrite-rust-fixture.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/embed-wasm-sourcemap.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/measure-container-tree.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/sync-loro-version.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/measure-container-id.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/publish-wasm-packages.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/run-js-doc-tests.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/cargo-release.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/container_id_cache_patch.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file loro-js/scripts/write-legacy-fixtures.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file scripts/cargo-fuzz-run.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-internal/scripts/mem.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-internal/scripts/fuzz.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/nodejs-snippets.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/test-commonjs.cjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-wasm/scripts/nodejs_patch.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file crates/loro-internal/scripts/run_mem.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×19
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×19
  • Duplicated block (9 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:964 — crates/fuzz/src/crdt_fuzzer.rs:964-972 | crates/loro-internal/src/fuzz.rs:9-17 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/loro-internal/src/fuzz.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:1122 — crates/fuzz/src/crdt_fuzzer.rs:1122-1130 | crates/loro-internal/src/fuzz.rs:49-57 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/loro-internal/src/fuzz.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/generic-btree/src/lib.rs:765 — crates/generic-btree/src/lib.rs:765-773 | crates/generic-btree/src/lib.rs:797-805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/container/richtext/tracker.rs:155 — crates/loro-internal/src/container/richtext/tracker.rs:155-163 | crates/loro-internal/src/container/richtext/tracker.rs:344-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/diff_calc.rs:1038 — crates/loro-internal/src/diff_calc.rs:1038-1046 | crates/loro-internal/src/diff_calc.rs:1820-1828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/encoding/shallow_snapshot.rs:1080 — crates/loro-internal/src/encoding/shallow_snapshot.rs:1080-1088 | crates/loro-internal/src/encoding/shallow_snapshot.rs:1104-1112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/handler.rs:2013 — crates/loro-internal/src/handler.rs:2013-2021 | crates/loro-internal/src/handler.rs:2037-2045 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/handler.rs:3271 — crates/loro-internal/src/handler.rs:3271-3279 | crates/loro-internal/src/handler.rs:3363-3371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/handler.rs:3393 — crates/loro-internal/src/handler.rs:3393-3401 | crates/loro-internal/src/handler.rs:4087-4095 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/state.rs:2667 — crates/loro-internal/src/state.rs:2667-2675 | crates/loro-internal/src/state.rs:2733-2741 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/value.rs:289 — crates/loro-internal/src/value.rs:289-297 | crates/loro-internal/src/value.rs:379-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-wasm-tools/src/main.rs:100 — crates/loro-wasm-tools/src/main.rs:100-108 | crates/loro-wasm-tools/src/main.rs:148-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/loro-wasm/src/awareness.rs:220 — crates/loro-wasm/src/awareness.rs:220-228 | crates/loro-wasm/src/lib.rs:2054-2062 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/kv-store/src/block.rs:848 — crates/kv-store/src/block.rs:848-856 | crates/kv-store/src/sstable.rs:904-912 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/handler.rs:4943 — crates/loro-internal/src/handler.rs:4943-4951 | crates/loro-internal/src/handler/tree.rs:1169-1177 — before extracting anything, compare `crates/loro-internal/src/handler.rs` and `crates/loro-internal/src/handler/tree.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:952 — crates/loro-internal/src/encoding/json_schema.rs:952-960 | crates/loro-internal/src/encoding/json_schema.rs:973-981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/fuzz/src/actor.rs:115 — crates/fuzz/src/actor.rs:115-123 | crates/fuzz/src/actor.rs:132-140 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:110 — crates/fuzz/src/crdt_fuzzer.rs:110-118 | crates/fuzz/src/one_doc_fuzzer.rs:402-410 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/fuzz/src/one_doc_fuzzer.rs:667 — crates/fuzz/src/one_doc_fuzzer.rs:667-675 | crates/fuzz/src/one_doc_fuzzer.rs:684-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D1 · Cyclomatic Complexity · loro_internal · ×18
  • loro_internal::dag::_find_meet_and_mode (cyclomatic 92) crates/loro-internal/src/dag.rs:710 — loro_internal::dag::_find_meet_and_mode has cyclomatic complexity 92 (threshold 15). Of this number, 53 points are the body's own statements and 39 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • loro_internal::encoding::json_schema::encode_change (cyclomatic 38) crates/loro-internal/src/encoding/json_schema.rs:291 — loro_internal::encoding::json_schema::encode_change 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.
  • loro_internal::encoding::json_schema::decode_op (cyclomatic 37) crates/loro-internal/src/encoding/json_schema.rs:780 — loro_internal::encoding::json_schema::decode_op has cyclomatic complexity 37 (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.
  • loro_internal::dag::_walk_to_meet (cyclomatic 36) crates/loro-internal/src/dag.rs:427 — loro_internal::dag::_walk_to_meet 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.
  • loro_internal::diff::diff_impl::dj_diff (cyclomatic 30) crates/loro-internal/src/diff/diff_impl.rs:361 — loro_internal::diff::diff_impl::dj_diff has cyclomatic complexity 30 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • loro_internal::encoding::outdated_encode_reordered::decode_op (cyclomatic 27) crates/loro-internal/src/encoding/outdated_encode_reordered.rs:288 — loro_internal::encoding::outdated_encode_reordered::decode_op has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • loro_internal::txn::change_to_diff (cyclomatic 23) crates/loro-internal/src/txn.rs:920 — loro_internal::txn::change_to_diff 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.
  • loro_internal::diff::diff_impl::find_middle_snake (cyclomatic 22) crates/loro-internal/src/diff/diff_impl.rs:182 — loro_internal::diff::diff_impl::find_middle_snake has cyclomatic complexity 22 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
  • loro_internal::jsonpath::jsonpath_impl::apply_selectors (cyclomatic 21) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:79 — loro_internal::jsonpath::jsonpath_impl::apply_selectors 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.
  • loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner (cyclomatic 20) crates/loro-internal/src/encoding/shallow_snapshot.rs:301 — loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner 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.
  • loro_internal::state::value_decode::encode_value (cyclomatic 20) crates/loro-internal/src/state/value_decode.rs:163 — loro_internal::state::value_decode::encode_value 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.
  • loro_internal::encoding::json_schema::json::redact_op (cyclomatic 19) crates/loro-internal/src/encoding/json_schema.rs:1791 — loro_internal::encoding::json_schema::json::redact_op 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.
  • loro_internal::jsonpath::jsonpath_impl::eval_expr (cyclomatic 19) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:191 — loro_internal::jsonpath::jsonpath_impl::eval_expr 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.
  • loro_internal::loro::isolated_scalar_root_batch (cyclomatic 17) crates/loro-internal/src/loro.rs:3705 — loro_internal::loro::isolated_scalar_root_batch 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.
  • loro_internal::oplog::known_history::op_eq (cyclomatic 17) crates/loro-internal/src/oplog/known_history.rs:450 — loro_internal::oplog::known_history::op_eq 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.
  • loro_internal::undo::movable_list::prepare (cyclomatic 17) crates/loro-internal/src/undo/movable_list.rs:590 — loro_internal::undo::movable_list::prepare 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.
  • loro_internal::oplog::known_history::list_op_eq (cyclomatic 16) crates/loro-internal/src/oplog/known_history.rs:508 — loro_internal::oplog::known_history::list_op_eq has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • loro_internal::state::richtext_state::snapshot::redact_dead_style_values (cyclomatic 16) crates/loro-internal/src/state/richtext_state.rs:1391 — loro_internal::state::richtext_state::snapshot::redact_dead_style_values 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×18
  • Hotspot: REDACTED REDACTED:5836 — REDACTED changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 100 in LoroDoc.#applyVersionTransition at line 5836. 22 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/loro.rs crates/loro-internal/src/loro.rs:2369 — crates/loro-internal/src/loro.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in LoroDoc::check_apply_diff_creates_no_unknown_container at line 2369. 16 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/loro.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/state.rs crates/loro-internal/src/state.rs:664 — crates/loro-internal/src/state.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in DocState::apply_diff at line 664. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/dag.rs crates/loro-internal/src/dag.rs:710 — crates/loro-internal/src/dag.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 92 in loro_internal::dag::_find_meet_and_mode at line 710. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/dag.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/diff_calc.rs crates/loro-internal/src/diff_calc.rs:186 — crates/loro-internal/src/diff_calc.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in DiffCalculator::try_calc_diff_internal at line 186. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/diff_calc.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/oplog.rs crates/loro-internal/src/oplog.rs:1142 — crates/loro-internal/src/oplog.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in OpLog::try_iter_from_replay_base_causally at line 1142. 14 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/oplog.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/encoding/shallow_snapshot.rs crates/loro-internal/src/encoding/shallow_snapshot.rs:301 — crates/loro-internal/src/encoding/shallow_snapshot.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner at line 301. 11 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/encoding/shallow_snapshot.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/oplog/change_store.rs crates/loro-internal/src/oplog/change_store.rs:1422 — crates/loro-internal/src/oplog/change_store.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in ChangeStore::get_change_by_lamport_lte at line 1422. 8 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/oplog/change_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/history_cache.rs crates/loro-internal/src/history_cache.rs:163 — crates/loro-internal/src/history_cache.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in ContainerHistoryCache::init_cache_by_visit_all_change_slow at line 163. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/history_cache.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: loro-js/src/runtime/containers.ts loro-js/src/runtime/containers.ts:1466 — loro-js/src/runtime/containers.ts changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in LoroText.iter at line 1466. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- loro-js/src/runtime/containers.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/state/richtext_state.rs crates/loro-internal/src/state/richtext_state.rs:1391 — crates/loro-internal/src/state/richtext_state.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in loro_internal::state::richtext_state::snapshot::redact_dead_style_values at line 1391. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state/richtext_state.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/encoding/json_schema.rs crates/loro-internal/src/encoding/json_schema.rs:780 — crates/loro-internal/src/encoding/json_schema.rs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in loro_internal::encoding::json_schema::decode_op at line 780. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/encoding/json_schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/encoding/outdated_encode_reordered.rs crates/loro-internal/src/encoding/outdated_encode_reordered.rs:288 — crates/loro-internal/src/encoding/outdated_encode_reordered.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in loro_internal::encoding::outdated_encode_reordered::decode_op at line 288. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/encoding/outdated_encode_reordered.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: loro-js/src/runtime/sequence-index.ts loro-js/src/runtime/sequence-index.ts:2947 — loro-js/src/runtime/sequence-index.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in sequence-index.recomputeOwnElements at line 2947. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- loro-js/src/runtime/sequence-index.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/container/richtext/richtext_state.rs crates/loro-internal/src/container/richtext/richtext_state.rs:2149 — crates/loro-internal/src/container/richtext/richtext_state.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in RichtextState::slice_delta at line 2149. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/container/richtext/richtext_state.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: loro-js/src/runtime/undo.ts loro-js/src/runtime/undo.ts:239 — loro-js/src/runtime/undo.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in UndoManager.#record at line 239. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- loro-js/src/runtime/undo.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/txn.rs crates/loro-internal/src/txn.rs:920 — crates/loro-internal/src/txn.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in loro_internal::txn::change_to_diff at line 920. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/txn.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/loro-internal/src/oplog/known_history.rs crates/loro-internal/src/oplog/known_history.rs:450 — crates/loro-internal/src/oplog/known_history.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in loro_internal::oplog::known_history::op_eq at line 450. 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-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/oplog/known_history.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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×16
  • Repeated repair: crates/loro/src/lib.rs crates/loro/src/lib.rs:4070 — crates/loro/src/lib.rs changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ValueOrContainer::get_deep_value at line 4070), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: roll back failed undo and redo applications (#1210)”; “fix: preserve undo and redo history boundaries on no-ops (#1202)”; “fix: keep binary import exact when JSON drops value bits”; “fix: Return decode errors from lazy history reads (#1177)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/oplog/pending_changes.rs crates/loro-internal/src/oplog/pending_changes.rs:335 — crates/loro-internal/src/oplog/pending_changes.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is OpLog::try_apply_pending at line 335), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: reduce overlapping import costs (#1176)”; “fix: reject imported Text ops past the end of the text (#1160) (#1169)”; “fix: reject malformed movable list move/set ops on import instead of aborting (#1125)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/oplog/pending_changes.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/arena.rs crates/loro-internal/src/arena.rs:647 — crates/loro-internal/src/arena.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is SharedArena::inner_convert_op at line 647), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: keep binary import exact when JSON drops value bits”; “fix: reduce overlapping import costs (#1176)”; “fix: keep shallow re-export and parent lookups working on inconsistent stored data (#1172)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/arena.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/encoding/fast_snapshot.rs crates/loro-internal/src/encoding/fast_snapshot.rs:164 — crates/loro-internal/src/encoding/fast_snapshot.rs changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is loro_internal::encoding::fast_snapshot::decode_snapshot_inner at line 164), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep binary import exact when JSON drops value bits”; “fix: Return decode errors from lazy history reads (#1177)”; “fix: reduce overlapping import costs (#1176)”; “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/encoding/fast_snapshot.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/encoding.rs crates/loro-internal/src/encoding.rs:174 — crates/loro-internal/src/encoding.rs changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is EncodeMode::from_i64 at line 174), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: keep binary import exact when JSON drops value bits”; “fix: Return decode errors from lazy history reads (#1177)”; “fix: drop containers deleted before the shallow root from shallow and state-only snapshots (#1119)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/encoding.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/state/container_store.rs crates/loro-internal/src/state/container_store.rs:393 — crates/loro-internal/src/state/container_store.rs changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is ContainerStore::check_eq_after_parsing at line 393), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”; “fix: drop dead containers when re-exporting a shallow doc at its cached root (#1123)”; “fix: drop containers deleted before the shallow root from shallow and state-only snapshots (#1119)”; “fix: bound the decoded container value cache to stop wasm memory growth on handle reads (#1093)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state/container_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/state/container_store/container_wrapper.rs crates/loro-internal/src/state/container_store/container_wrapper.rs:747 — crates/loro-internal/src/state/container_store/container_wrapper.rs changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ContainerWrapper::decode_state at line 747), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: resolve a container's parent from the change that created it (#1159)”; “fix: drop dead containers when re-exporting a shallow doc at its cached root (#1123)”; “fix: drop containers deleted before the shallow root from shallow and state-only snapshots (#1119)”; “fix: bound the decoded container value cache to stop wasm memory growth on handle reads (#1093)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state/container_store/container_wrapper.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/oplog/change_store/block_encode.rs crates/loro-internal/src/oplog/change_store/block_encode.rs:608 — crates/loro-internal/src/oplog/change_store/block_encode.rs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is loro_internal::oplog::change_store::block_encode::decode_block at line 608), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: Return decode errors from lazy history reads (#1177)”; “fix: reduce overlapping import costs (#1176)”; “fix: reject malformed movable list move/set ops on import instead of aborting (#1125)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/oplog/change_store/block_encode.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/state/container_store/inner_store.rs crates/loro-internal/src/state/container_store/inner_store.rs:252 — crates/loro-internal/src/state/container_store/inner_store.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is InnerStore::trim_value_cache at line 252), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”; “fix: drop containers deleted before the shallow root from shallow and state-only snapshots (#1119)”; “fix: bound the decoded container value cache to stop wasm memory growth on handle reads (#1093)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state/container_store/inner_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/diff_calc/tree.rs crates/loro-internal/src/diff_calc/tree.rs:205 — crates/loro-internal/src/diff_calc/tree.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is TreeDiffCalculator::checkout_diff at line 205), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: take the tree checkout window from the two versions (#1152)”; “fix: pick shallow roots as critical versions of the retained history (#1104)”; “fix: avoid false concurrent import replay (#1058)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/diff_calc/tree.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/handler/tree.rs crates/loro-internal/src/handler/tree.rs:447 — crates/loro-internal/src/handler/tree.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is TreeHandler::create_at_with_target_for_apply_diff at line 447), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: traverse deep trees without overflowing the stack (#1206)”; “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”; “fix: reject inserting a container attached to another doc (#1111)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/handler/tree.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/utils/subscription.rs crates/loro-internal/src/utils/subscription.rs:409 — crates/loro-internal/src/utils/subscription.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is SubscriberSet::retain at line 409), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”; “fix(subscription): don't panic when subscribing during an emit (#1105)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/utils/subscription.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/event.rs crates/loro-internal/src/event.rs:400 — crates/loro-internal/src/event.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is InternalDiff::is_empty at line 400), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep binary import exact when JSON drops value bits”; “fix: reject creating unknown-type containers instead of panicking (#1142)”; “fix: restore deleted mergeable children once on revert/apply_diff/undo (#1134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/event.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/loro-internal/src/state/dead_containers_cache.rs crates/loro-internal/src/state/dead_containers_cache.rs:47 — crates/loro-internal/src/state/dead_containers_cache.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is DocState::is_deleted at line 47), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: prevent quadratic cache clears and preserve fork text styles (#1174)”; “fix: issue sweep (#1118, #1162, #1155, #1165, #1156, #1164, #1157, #1154, #1151; #1149 documented) (#1171)”; “fix: drop cached container deletions that a move can undo (#1153)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- crates/loro-internal/src/state/dead_containers_cache.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: loro-js/scripts/rewrite-rust-fixture.mjs loro-js/scripts/rewrite-rust-fixture.mjs:303 — loro-js/scripts/rewrite-rust-fixture.mjs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is rewrite-rust-fixture.normalizeRuntimeJson at line 303), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(loro.js): model MovableList like Rust (positions and LWW elements) (#1166)”; “fix(loro.js): keep rich-text style anchors in the text sequence (#1137)”; “fix: encode loro.js tree state in Rust sibling order and tolerate out-of-order siblings (#1108)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- loro-js/scripts/rewrite-rust-fixture.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: loro-js/src/runtime/types.ts loro-js/src/runtime/types.ts:171 — loro-js/src/runtime/types.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is (anonymous) at line 171), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(loro.js): include reattached child containers' state in diff() and revertTo() (#1131)”; “fix(loro.js): write counter and binary JSON values in Rust's format (#1133)”; “fix(loro.js): use the Rust `L{lamport}@{peer}` format for movable-list JSON element IDs (#1129)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-25..2026-10-23, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-25 08:25:29 +00:00' --until='2026-10-23 08:25:29 +00:00' --full-history --no-merges -- loro-js/src/runtime/types.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×16
  • Duplicated block (5 lines × 2) crates/dev-utils/src/lib.rs:82 — crates/dev-utils/src/lib.rs:82-86 | crates/dev-utils/src/lib.rs:94-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/diff/diff_impl.rs:206 — crates/loro-internal/src/diff/diff_impl.rs:206-210 | crates/loro-internal/src/diff/diff_impl.rs:235-239 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:673 — crates/loro-internal/src/handler.rs:673-677 | crates/loro-internal/src/handler.rs:687-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/history_cache.rs:864 — crates/loro-internal/src/history_cache.rs:864-868 | crates/loro-internal/src/history_cache.rs:886-890 — both copies are in the same file, so extract the 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) crates/loro-internal/src/oplog/change_store.rs:1098 — crates/loro-internal/src/oplog/change_store.rs:1098-1102 | crates/loro-internal/src/oplog/change_store.rs:1136-1140 — both copies are in the same file, so extract the 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) crates/loro-internal/src/state/list_state.rs:786 — crates/loro-internal/src/state/list_state.rs:786-790 | crates/loro-internal/src/state/tree_state.rs:1974-1978 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/value.rs:50 — crates/loro-internal/src/value.rs:50-54 | crates/loro-internal/src/value.rs:118-122 — both copies are in the same file, so extract the 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) crates/loro-internal/src/value.rs:61 — crates/loro-internal/src/value.rs:61-65 | crates/loro-internal/src/value.rs:133-137 — both copies are in the same file, so extract the 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) crates/loro-internal/src/value.rs:94 — crates/loro-internal/src/value.rs:94-98 | crates/loro-internal/src/value.rs:176-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/delta/text.rs:91 — crates/loro-internal/src/delta/text.rs:91-95 | crates/loro-internal/src/event.rs:359-363 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/delta/map_delta.rs:27 — crates/loro-internal/src/delta/map_delta.rs:27-31 | crates/loro-internal/src/history_cache.rs:618-622 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) crates/loro-wasm/src/convert.rs:534 — crates/loro-wasm/src/convert.rs:534-538 | crates/loro-wasm/src/convert.rs:591-595 — both copies are in the same file, so extract the 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) crates/loro-internal/src/oplog/change_store/block_encode.rs:470 — crates/loro-internal/src/oplog/change_store/block_encode.rs:470-474 | crates/loro-internal/src/oplog/change_store/block_encode.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.
  • Duplicated block (5 lines × 2) crates/loro-internal/src/container/richtext/style_range_map.rs:58 — crates/loro-internal/src/container/richtext/style_range_map.rs:58-62 | crates/loro-internal/src/container/richtext/style_range_map.rs:66-70 — both copies are in the same file, so extract the 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) crates/loro-internal/src/oplog/change_store/block_encode.rs:480 — crates/loro-internal/src/oplog/change_store/block_encode.rs:480-484 | crates/loro-internal/src/oplog/change_store/block_encode.rs:485-489 — both copies are in the same file, so extract the 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) crates/loro-internal/src/state/container_store/inner_store.rs:144 — crates/loro-internal/src/state/container_store/inner_store.rs:144-148 | crates/loro-internal/src/state/container_store/inner_store.rs:187-191 — both copies are in the same file, so extract the 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 (8 lines × 2) · ×15
  • Duplicated block (8 lines × 2) crates/generic-btree/src/lib.rs:2091 — crates/generic-btree/src/lib.rs:2091-2098 | crates/generic-btree/src/lib.rs:2113-2120 — both copies are in the same file, so extract the 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) crates/loro-internal/src/container/richtext/style_range_map.rs:192 — crates/loro-internal/src/container/richtext/style_range_map.rs:192-199 | crates/loro-internal/src/container/richtext/style_range_map.rs:234-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/loro-internal/src/container/richtext/style_range_map.rs:313 — crates/loro-internal/src/container/richtext/style_range_map.rs:313-320 | crates/loro-internal/src/container/richtext/style_range_map.rs:344-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/loro-internal/src/dag/iter.rs:80 — crates/loro-internal/src/dag/iter.rs:80-87 | crates/loro-internal/src/dag/iter.rs:161-168 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:805 — crates/loro-internal/src/handler.rs:805-812 | crates/loro-internal/src/handler.rs:922-929 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:815 — crates/loro-internal/src/handler.rs:815-822 | crates/loro-internal/src/handler.rs:932-939 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:3312 — crates/loro-internal/src/handler.rs:3312-3319 | crates/loro-internal/src/handler.rs:3882-3889 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:3404 — crates/loro-internal/src/handler.rs:3404-3411 | crates/loro-internal/src/handler.rs:4099-4106 — both copies are in the same file, so extract the 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) crates/loro-internal/src/handler.rs:3746 — crates/loro-internal/src/handler.rs:3746-3753 | crates/loro-internal/src/handler.rs:3941-3948 — both copies are in the same file, so extract the 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) crates/loro-internal/src/state/container_store/container_wrapper.rs:331 — crates/loro-internal/src/state/container_store/container_wrapper.rs:331-338 | crates/loro-internal/src/state/container_store/container_wrapper.rs:364-371 — both copies are in the same file, so extract the 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) crates/loro-internal/src/container/richtext/style_range_map.rs:559 — crates/loro-internal/src/container/richtext/style_range_map.rs:559-566 | crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:801-808 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) crates/loro-wasm/src/convert.rs:659 — crates/loro-wasm/src/convert.rs:659-666 | crates/loro-wasm/src/convert.rs:683-690 — both copies are in the same file, so extract the 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) crates/loro-internal/src/state/value_decode.rs:106 — crates/loro-internal/src/state/value_decode.rs:106-113 | crates/loro-internal/src/state/value_decode.rs:137-144 — both copies are in the same file, so extract the 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) crates/fuzz/src/actor.rs:607 — crates/fuzz/src/actor.rs:607-614 | crates/fuzz/src/actor.rs:624-631 — both copies are in the same file, so extract the 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) crates/fuzz/src/value.rs:202 — crates/fuzz/src/value.rs:202-209 | crates/fuzz/src/value.rs:283-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · FunctionTooLong · ×14
  • FunctionTooLong: loro_internal::dag::_find_meet_and_mode crates/loro-internal/src/dag.rs:710 — FunctionTooLong — loro_internal::dag::_find_meet_and_mode runs 271 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 171 over it, 2.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.
  • FunctionTooLong: loro_internal::encoding::json_schema::decode_op crates/loro-internal/src/encoding/json_schema.rs:780 — FunctionTooLong — loro_internal::encoding::json_schema::decode_op runs 199 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 99 over it, 1.99× 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: loro_internal::encoding::outdated_encode_reordered::decode_op crates/loro-internal/src/encoding/outdated_encode_reordered.rs:288 — FunctionTooLong — loro_internal::encoding::outdated_encode_reordered::decode_op runs 199 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 99 over it, 1.99× 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: loro_internal::encoding::json_schema::encode_change crates/loro-internal/src/encoding/json_schema.rs:291 — FunctionTooLong — loro_internal::encoding::json_schema::encode_change runs 185 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 85 over it, 1.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: document.jsonOperationToDecoded REDACTED:10197 — FunctionTooLong — jsonOperationToDecoded runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loro_internal::txn::change_to_diff crates/loro-internal/src/txn.rs:920 — FunctionTooLong — loro_internal::txn::change_to_diff runs 168 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 68 over it, 1.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner crates/loro-internal/src/encoding/shallow_snapshot.rs:301 — FunctionTooLong — loro_internal::encoding::shallow_snapshot::export_shallow_snapshot_inner runs 167 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 67 over it, 1.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loro_internal::oplog::change_store::block_encode::decode_block crates/loro-internal/src/oplog/change_store/block_encode.rs:608 — FunctionTooLong — loro_internal::oplog::change_store::block_encode::decode_block runs 159 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loro_internal::diff::diff_impl::dj_diff crates/loro-internal/src/diff/diff_impl.rs:361 — FunctionTooLong — loro_internal::diff::diff_impl::dj_diff runs 138 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: measure-snapshot-round-memory.runWorker crates/loro-wasm/scripts/measure-snapshot-round-memory.cjs:130 — FunctionTooLong — runWorker runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: change-block-codec.decodeOperationContent loro-js/src/codec/change-block-codec.ts:358 — FunctionTooLong — decodeOperationContent runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
  • FunctionTooLong: loro_internal::oplog::change_store::block_meta_encode::decode_changes_header crates/loro-internal/src/oplog/change_store/block_meta_encode.rs:90 — FunctionTooLong — loro_internal::oplog::change_store::block_meta_encode::decode_changes_header 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: document.decodedOperationToJson REDACTED:9917 — FunctionTooLong — decodedOperationToJson runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: change-value.decodeChangeValueContent loro-js/src/codec/change-value.ts:86 — FunctionTooLong — decodeChangeValueContent runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× 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.
D2 · Cognitive Complexity · DocState · ×13
  • DocState::apply_diff (cognitive 70) crates/loro-internal/src/state.rs:664 — DocState::apply_diff has cognitive complexity 70 (threshold 15). Drivers by points: if/else 24 (51 pts), loops 5 (9 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::get_value_by_path (cognitive 65) crates/loro-internal/src/state.rs:2575 — DocState::get_value_by_path has cognitive complexity 65 (threshold 15). Drivers by points: if/else 21 (47 pts), match/switch 7 (17 pts), loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::ensure_containers_created_by_internal_diff (cognitive 40) crates/loro-internal/src/state.rs:938 — DocState::ensure_containers_created_by_internal_diff has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 6 (14 pts), 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.
  • DocState::get_alive_children_of (cognitive 32) crates/loro-internal/src/state.rs:2172 — DocState::get_alive_children_of has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 17). 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.
  • DocState::unreached_stored_containers (cognitive 26) crates/loro-internal/src/state.rs:2009 — DocState::unreached_stored_containers has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::get_container_deep_value (cognitive 25) crates/loro-internal/src/state.rs:1817 — DocState::get_container_deep_value has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (7 pts), boolean chains 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::get_container_deep_value_with_id (cognitive 22) crates/loro-internal/src/state.rs:1721 — DocState::get_container_deep_value_with_id has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::diffs_to_event (cognitive 21) crates/loro-internal/src/state.rs:2263 — DocState::diffs_to_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 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.
  • DocState::read_container_tree (cognitive 19) crates/loro-internal/src/state/container_tree.rs:29 — DocState::read_container_tree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • DocState::set_container_parent_by_raw_op (cognitive 17) crates/loro-internal/src/parent.rs:62 — DocState::set_container_parent_by_raw_op has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (4 pts), loops 1 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • DocState::get_reachable (cognitive 17) crates/loro-internal/src/state.rs:2366 — DocState::get_reachable 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.
  • DocState::is_deleted (cognitive 16) crates/loro-internal/src/state/dead_containers_cache.rs:47 — DocState::is_deleted has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, loops 2, match/switch 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.
  • DocState::does_container_exist (cognitive 16) crates/loro-internal/src/state.rs:1163 — DocState::does_container_exist has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×12
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D2 · Cognitive Complexity · LoroDoc · ×11
  • LoroDoc::check_apply_diff_creates_no_unknown_container (cognitive 122) crates/loro-internal/src/loro.rs:2369 — LoroDoc::check_apply_diff_creates_no_unknown_container has cognitive complexity 122 (threshold 15). Drivers by points: if/else 24 (75 pts), loops 7 (22 pts), match/switch 6 (16 pts), boolean chains 9 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoroDoc::apply_diff_with_movable_undo (cognitive 67) crates/loro-internal/src/loro.rs:2061 — LoroDoc::apply_diff_with_movable_undo has cognitive complexity 67 (threshold 15). Drivers by points: if/else 23 (47 pts), match/switch 3 (11 pts), loops 3 (5 pts), boolean chains 4 (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.
  • LoroDoc::import_changes_and_apply_delta_to_state_if_needed (cognitive 62) crates/loro-internal/src/loro.rs:864 — LoroDoc::import_changes_and_apply_delta_to_state_if_needed has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (41 pts), match/switch 8 (13 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoroDoc::import_batch_with_history_mode (cognitive 34) crates/loro-internal/src/loro.rs:2668 — LoroDoc::import_batch_with_history_mode has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 3 (8 pts), match/switch 3 (7 pts), boolean chains 3 (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.
  • LoroDoc::commit_internal_inner (cognitive 33) crates/loro-internal/src/loro.rs:392 — LoroDoc::commit_internal_inner has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 2, 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.
  • LoroDoc::plan_full_state_batch (cognitive 33) crates/loro-internal/src/loro.rs:2249 — LoroDoc::plan_full_state_batch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LoroDoc::subscribe_jsonpath (cognitive 29) crates/loro-internal/src/jsonpath/subscription.rs:258 — LoroDoc::subscribe_jsonpath has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 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.
  • LoroDoc::query_pos_internal (cognitive 28) crates/loro-internal/src/loro.rs:3249 — LoroDoc::query_pos_internal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LoroDoc::undo_internal_with (cognitive 26) crates/loro-internal/src/loro.rs:1452 — LoroDoc::undo_internal_with has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (19 pts), loops 3 (4 pts), match/switch 2, 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.
  • LoroDoc::update_oplog_and_apply_delta_to_state_if_needed (cognitive 19) crates/loro-internal/src/loro.rs:780 — LoroDoc::update_oplog_and_apply_delta_to_state_if_needed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3 (7 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.
  • LoroDoc::travel_change_ancestors (cognitive 18) crates/loro-internal/src/loro.rs:3790 — LoroDoc::travel_change_ancestors has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (5 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.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×11
  • Duplicated block (6 lines × 2) crates/loro-internal/src/diff_calc.rs:1015 — crates/loro-internal/src/diff_calc.rs:1015-1020 | crates/loro-internal/src/diff_calc.rs:1805-1810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:1144 — crates/loro-internal/src/handler.rs:1144-1149 | crates/loro-internal/src/handler.rs:1345-1350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:3282 — crates/loro-internal/src/handler.rs:3282-3287 | crates/loro-internal/src/handler.rs:3376-3381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:3754 — crates/loro-internal/src/handler.rs:3754-3759 | crates/loro-internal/src/handler.rs:3953-3958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/handler/tree.rs:409 — crates/loro-internal/src/handler/tree.rs:409-414 | crates/loro-internal/src/handler/tree.rs:435-440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/jsonpath/parser.rs:307 — crates/loro-internal/src/jsonpath/parser.rs:307-312 | crates/loro-internal/src/jsonpath/parser.rs:433-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/state/container_store/inner_store.rs:350 — crates/loro-internal/src/state/container_store/inner_store.rs:350-355 | crates/loro-internal/src/state/container_store/inner_store.rs:377-382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro-internal/src/version.rs:563 — crates/loro-internal/src/version.rs:563-568 | crates/loro-internal/src/version.rs:597-602 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/loro/src/event.rs:175 — crates/loro/src/event.rs:175-180 | crates/loro/src/event.rs:228-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/delta/src/delta_rope/rle_tree.rs:83 — crates/delta/src/delta_rope/rle_tree.rs:83-88 | crates/loro-internal/src/container/richtext/style_range_map.rs:584-589 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/fuzz/src/container/tree.rs:245 — crates/fuzz/src/container/tree.rs:245-250 | crates/fuzz/src/one_doc_fuzzer.rs:339-345 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×10
  • Duplicated block (11 lines × 2) crates/kv-store/src/sstable.rs:931 — crates/kv-store/src/sstable.rs:931-941 | crates/loro-internal/src/kv_store.rs:38-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/loro-internal/src/container/richtext/richtext_state.rs:604 — crates/loro-internal/src/container/richtext/richtext_state.rs:604-614 | crates/loro-internal/src/container/richtext/richtext_state.rs:625-635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-internal/src/container/richtext/tracker.rs:387 — crates/loro-internal/src/container/richtext/tracker.rs:387-397 | crates/loro-internal/src/container/richtext/tracker.rs:492-502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-internal/src/handler.rs:3533 — crates/loro-internal/src/handler.rs:3533-3543 | crates/loro-internal/src/handler.rs:4249-4259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-internal/src/state/tree_state.rs:1230 — crates/loro-internal/src/state/tree_state.rs:1230-1240 | crates/loro-internal/src/state/tree_state.rs:1255-1265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-wasm-tools/src/main.rs:170 — crates/loro-wasm-tools/src/main.rs:170-180 | crates/loro-wasm-tools/src/main.rs:238-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-wasm/src/lib.rs:4070 — crates/loro-wasm/src/lib.rs:4070-4080 | crates/loro-wasm/src/lib.rs:4512-4522 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/loro-wasm/src/lib.rs:4081 — crates/loro-wasm/src/lib.rs:4081-4091 | crates/loro-wasm/src/lib.rs:4523-4533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/fuzz/src/container/list.rs:133 — crates/fuzz/src/container/list.rs:133-143 | crates/fuzz/src/container/movable_list.rs:163-173 — 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 (11 lines × 2) crates/fuzz/src/value.rs:406 — crates/fuzz/src/value.rs:406-416 | crates/fuzz/src/value.rs:425-435 — both copies are in the same file, so extract the 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 (13 lines × 2) · ×9
  • Duplicated block (13 lines × 2) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:530 — crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:530-542 | crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:546-558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/loro-internal/src/oplog/change_store.rs:751 — crates/loro-internal/src/oplog/change_store.rs:751-763 | crates/loro-internal/src/oplog/change_store.rs:783-795 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/loro-internal/src/version.rs:853 — crates/loro-internal/src/version.rs:853-865 | crates/loro-internal/src/version.rs:869-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/loro-wasm/src/convert.rs:479 — crates/loro-wasm/src/convert.rs:479-491 | crates/loro-wasm/src/convert.rs:565-577 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/loro-wasm/src/lib.rs:2156 — crates/loro-wasm/src/lib.rs:2156-2168 | crates/loro-wasm/src/lib.rs:2192-2204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/fuzz/src/container/tree.rs:214 — crates/fuzz/src/container/tree.rs:214-226 | crates/fuzz/src/one_doc_fuzzer.rs:307-319 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:680 — crates/fuzz/src/crdt_fuzzer.rs:680-692 | crates/fuzz/src/one_doc_fuzzer.rs:941-953 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) crates/fuzz/src/one_doc_fuzzer.rs:120 — crates/fuzz/src/one_doc_fuzzer.rs:120-132 | crates/fuzz/src/one_doc_fuzzer.rs:153-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/fuzz/src/one_doc_fuzzer.rs:212 — crates/fuzz/src/one_doc_fuzzer.rs:212-224 | crates/fuzz/src/one_doc_fuzzer.rs:251-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×9
  • Duplicated block (10 lines × 2) crates/kv-store/src/block.rs:757 — crates/kv-store/src/block.rs:757-766 | crates/kv-store/src/block.rs:781-790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-internal/src/diff_calc.rs:285 — crates/loro-internal/src/diff_calc.rs:285-294 | crates/loro-internal/src/diff_calc.rs:617-626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-internal/src/handler.rs:3254 — crates/loro-internal/src/handler.rs:3254-3263 | crates/loro-internal/src/handler.rs:3718-3727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-internal/src/state.rs:1752 — crates/loro-internal/src/state.rs:1752-1761 | crates/loro-internal/src/state.rs:1781-1790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-wasm/src/lib.rs:4035 — crates/loro-wasm/src/lib.rs:4035-4044 | crates/loro-wasm/src/lib.rs:4477-4486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-internal/src/state/richtext_state.rs:697 — crates/loro-internal/src/state/richtext_state.rs:697-706 | crates/loro-internal/src/state/richtext_state.rs:723-732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:855 — crates/loro-internal/src/encoding/json_schema.rs:855-864 | crates/loro-internal/src/encoding/json_schema.rs:891-900 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/fuzz/src/container/tree.rs:277 — crates/fuzz/src/container/tree.rs:277-286 | crates/fuzz/src/one_doc_fuzzer.rs:379-389 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:66 — crates/fuzz/src/crdt_fuzzer.rs:66-75 | crates/fuzz/src/one_doc_fuzzer.rs:82-91 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×8
  • Duplicated block (7 lines × 2) crates/loro-internal/src/handler.rs:4433 — crates/loro-internal/src/handler.rs:4433-4439 | crates/loro-internal/src/handler.rs:4449-4455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/loro-internal/src/oplog/change_store/block_encode.rs:326 — crates/loro-internal/src/oplog/change_store/block_encode.rs:326-332 | crates/loro-internal/src/oplog/change_store/block_encode.rs:338-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/loro-internal/src/state.rs:76 — crates/loro-internal/src/state.rs:76-82 | crates/loro-internal/src/state/container_store/container_wrapper.rs:806-812 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/loro-internal/src/value.rs:81 — crates/loro-internal/src/value.rs:81-87 | crates/loro-internal/src/value.rs:163-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/loro-internal/src/handler/movable_list_apply_delta.rs:355 — crates/loro-internal/src/handler/movable_list_apply_delta.rs:355-361 | crates/loro-internal/src/loro.rs:4987-4993 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) crates/loro-wasm/src/counter.rs:91 — crates/loro-wasm/src/counter.rs:91-97 | crates/loro-wasm/src/lib.rs:5500-5506 — 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) crates/fuzz/src/actor.rs:617 — crates/fuzz/src/actor.rs:617-623 | crates/fuzz/src/actor.rs:634-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/fuzz/src/container/counter.rs:44 — crates/fuzz/src/container/counter.rs:44-50 | crates/fuzz/src/container/list.rs:45-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D1 · Cyclomatic Complexity · LoroDoc · ×7
  • LoroDoc::check_apply_diff_creates_no_unknown_container (cyclomatic 48) crates/loro-internal/src/loro.rs:2369 — LoroDoc::check_apply_diff_creates_no_unknown_container has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LoroDoc::import_changes_and_apply_delta_to_state_if_needed (cyclomatic 36) crates/loro-internal/src/loro.rs:864 — LoroDoc::import_changes_and_apply_delta_to_state_if_needed 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.
  • LoroDoc::apply_diff_with_movable_undo (cyclomatic 30) crates/loro-internal/src/loro.rs:2061 — LoroDoc::apply_diff_with_movable_undo 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.
  • LoroDoc::undo_internal_with (cyclomatic 22) crates/loro-internal/src/loro.rs:1452 — LoroDoc::undo_internal_with 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.
  • LoroDoc::query_pos_internal (cyclomatic 20) crates/loro-internal/src/loro.rs:3249 — LoroDoc::query_pos_internal 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.
  • LoroDoc::import_batch_with_history_mode (cyclomatic 19) crates/loro-internal/src/loro.rs:2668 — LoroDoc::import_batch_with_history_mode 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.
  • LoroDoc::commit_internal_inner (cyclomatic 18) crates/loro-internal/src/loro.rs:392 — LoroDoc::commit_internal_inner 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 · RichtextState · ×7
  • RichtextState::apply_diff (cognitive 127) crates/loro-internal/src/state/richtext_state.rs:615 — RichtextState::apply_diff has cognitive complexity 127 (threshold 15). Drivers by points: if/else 26 (75 pts), match/switch 6 (26 pts), loops 7 (22 pts), boolean chains 4 (nesting depth added 84). 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.
  • RichtextState::apply_diff_and_convert (cognitive 74) crates/loro-internal/src/state/richtext_state.rs:379 — RichtextState::apply_diff_and_convert has cognitive complexity 74 (threshold 15). Drivers by points: if/else 8 (33 pts), match/switch 5 (21 pts), loops 5 (20 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.
  • RichtextState::find_best_insert_pos (cognitive 36) crates/loro-internal/src/container/richtext/richtext_state.rs:1846 — RichtextState::find_best_insert_pos has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 5 (11 pts), loops 4 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RichtextState::slice_delta (cognitive 33) crates/loro-internal/src/container/richtext/richtext_state.rs:2149 — RichtextState::slice_delta has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (8 pts), match/switch 3 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RichtextState::drain_by_entity_index (cognitive 31) crates/loro-internal/src/container/richtext/richtext_state.rs:2317 — RichtextState::drain_by_entity_index has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 2 (3 pts), loops 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.
  • RichtextState::get_text_index_of_id (cognitive 18) crates/loro-internal/src/state/richtext_state.rs:216 — RichtextState::get_text_index_of_id has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (6 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RichtextState::try_get_cache_or_clean (cognitive 17) crates/loro-internal/src/container/richtext/richtext_state.rs:125 — RichtextState::try_get_cache_or_clean has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BTree · ×7
  • BTree::handle_lack_single_layer (cognitive 69) crates/generic-btree/src/lib.rs:2004 — BTree::handle_lack_single_layer has cognitive complexity 69 (threshold 15). Drivers by points: loops 11 (42 pts), if/else 13 (23 pts), match/switch 2 (4 pts) (nesting depth added 43). 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.
  • BTree::update_leaf (cognitive 43) crates/generic-btree/src/lib.rs:1267 — BTree::update_leaf has cognitive complexity 43 (threshold 15). Drivers by points: if/else 23 (41 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BTree::update_leaves_with_arg_in_ranges (cognitive 39) crates/generic-btree/src/lib.rs:1404 — BTree::update_leaves_with_arg_in_ranges has cognitive complexity 39 (threshold 15). Drivers by points: loops 9 (22 pts), if/else 5 (16 pts), boolean chains 1 (nesting depth added 24). 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.
  • BTree::update_leaf_by_search (cognitive 32) crates/generic-btree/src/lib.rs:1116 — BTree::update_leaf_by_search has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BTree::update_dirty_cache_map (cognitive 23) crates/generic-btree/src/lib.rs:1520 — BTree::update_dirty_cache_map has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 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.
  • BTree::check (cognitive 19) crates/generic-btree/src/lib.rs:2778 — BTree::check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (6 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BTree::insert_many_by_cursor (cognitive 17) crates/generic-btree/src/lib.rs:681 — BTree::insert_many_by_cursor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 3 (4 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 · ChangeStore · ×7
  • ChangeStore::get_change_by_lamport_lte (cognitive 53) crates/loro-internal/src/oplog/change_store.rs:1422 — ChangeStore::get_change_by_lamport_lte has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (42 pts), match/switch 4 (6 pts), boolean chains 3, loops 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.
  • ChangeStore::build_root_history_names (cognitive 45) crates/loro-internal/src/oplog/change_store.rs:738 — ChangeStore::build_root_history_names has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 6 (14 pts), match/switch 3 (7 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.
  • ChangeStore::export_blocks_in_range (cognitive 27) crates/loro-internal/src/oplog/change_store.rs:337 — ChangeStore::export_blocks_in_range has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 7 (12 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.
  • ChangeStore::iter_blocks_inner (cognitive 20) crates/loro-internal/src/oplog/change_store.rs:868 — ChangeStore::iter_blocks_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (3 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.
  • ChangeStore::insert_change_inner (cognitive 18) crates/loro-internal/src/oplog/change_store.rs:1344 — ChangeStore::insert_change_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (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.
  • ChangeStore::load_blocks_in_range (cognitive 18) crates/loro-internal/src/oplog/change_store.rs:1877 — ChangeStore::load_blocks_in_range has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (3 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.
  • ChangeStore::import_all (cognitive 16) crates/loro-internal/src/oplog/change_store.rs:1182 — ChangeStore::import_all has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), 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.
D17 · Explicit Debt · FixmeComment · ×6
  • FixmeComment crates/loro-internal/src/loro.rs:1724 — // FIXME: This method needs testing (no event should be emitted during processing this) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/loro-internal/src/oplog.rs:1284 — // FIXME: PERF: it looks slow for large vv, like 10000+ entries — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/loro-internal/src/state/container_store/container_wrapper.rs:798 — // FIXME: it's not very accurate... — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/loro/tests/integration_test/undo_test.rs:800 — // FIXME: right now redo/undo like this is wasteful — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/generic-btree/src/lib.rs:2132 — // FIXME: make this work — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/delta/src/delta_rope.rs:280 — // FIXME: transform the attributes — 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.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×6
  • Duplicated block (15 lines × 2) crates/generic-btree/src/lib.rs:2886 — crates/generic-btree/src/lib.rs:2886-2900 | crates/generic-btree/src/lib.rs:2936-2950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:839 — crates/loro-internal/src/encoding/json_schema.rs:839-853 | crates/loro-internal/src/encoding/json_schema.rs:875-889 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/loro-internal/src/state/movable_list_state.rs:1273 — crates/loro-internal/src/state/movable_list_state.rs:1273-1287 | crates/loro-internal/src/state/movable_list_state.rs:1320-1334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/loro-internal/src/value.rs:254 — crates/loro-internal/src/value.rs:254-268 | crates/loro-internal/src/value.rs:355-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/loro-internal/src/version.rs:774 — crates/loro-internal/src/version.rs:774-788 | crates/loro-internal/src/version.rs:835-849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/fuzz/src/actor.rs:469 — crates/fuzz/src/actor.rs:469-483 | crates/fuzz/src/actor.rs:485-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.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×6
  • Duplicated block (13 lines × 2 locations) loro-js/src/codec/bytes.ts:190 — loro-js/src/codec/bytes.ts:190 · loro-js/src/codec/lz4.ts:314 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (13 lines × 2 locations) loro-js/src/codec/change-block-codec.ts:379 — loro-js/src/codec/change-block-codec.ts:379 · loro-js/src/codec/change-block-codec.ts:437 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) REDACTED:5143 — REDACTED:5143 · REDACTED:10074 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2 locations) REDACTED:9758 — REDACTED:9758 · REDACTED:9772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2 locations) loro-js/src/runtime/event-diff.ts:304 — loro-js/src/runtime/event-diff.ts:304 · loro-js/src/runtime/sequence-index.ts:3418 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (13 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:709 — loro-js/src/runtime/sequence-index.ts:709 · loro-js/src/runtime/sequence-index.ts:979 — both copies are in the same file, so extract the 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 (19 lines × 2) · ×5
  • Duplicated block (19 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:734 — crates/loro-internal/src/encoding/json_schema.rs:734-752 | crates/loro-internal/src/handler.rs:64-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) crates/loro-internal/src/handler.rs:3333 — crates/loro-internal/src/handler.rs:3333-3351 | crates/loro-internal/src/handler.rs:3903-3921 — both copies are in the same file, so extract the 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 (19 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:146 — crates/fuzz/src/crdt_fuzzer.rs:146-164 | crates/fuzz/src/crdt_fuzzer.rs:224-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:323 — crates/fuzz/src/crdt_fuzzer.rs:323-341 | crates/fuzz/src/one_doc_fuzzer.rs:754-772 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:386 — crates/fuzz/src/crdt_fuzzer.rs:386-404 | crates/fuzz/src/one_doc_fuzzer.rs:817-835 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×5
  • Sync-over-async blocking examples/bundler-smoke-tests/scripts/browser-runtime.mjs:64 — `existsSync` in `findEntrypoint` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking examples/bundler-smoke-tests/scripts/browser-runtime.mjs:91 — `existsSync` in `callback to createServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking examples/bundler-smoke-tests/scripts/browser-runtime.mjs:114 — `existsSync` in `callback to createServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking examples/bundler-smoke-tests/scripts/browser-runtime.mjs:293 — `existsSync` in `runCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking examples/bundler-smoke-tests/scripts/dev-runtime.mjs:232 — `existsSync` in `runCase` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×5
  • Duplicated block (14 lines × 2 locations) loro-js/src/codec/sstable.ts:550 — loro-js/src/codec/sstable.ts:550 · loro-js/src/codec/sstable.ts:565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2 locations) REDACTED:4849 — REDACTED:4849 · REDACTED:4869 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) REDACTED:6622 — REDACTED:6622 · REDACTED:6725 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) REDACTED:10609 — REDACTED:10609 · REDACTED:10644 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) REDACTED:10943 — REDACTED:10943 · loro-js/src/runtime/movable-list.ts:159 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
D1 · Cyclomatic Complexity · RichtextState · ×4
  • RichtextState::apply_diff (cyclomatic 40) crates/loro-internal/src/state/richtext_state.rs:615 — RichtextState::apply_diff 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.
  • RichtextState::apply_diff_and_convert (cyclomatic 20) crates/loro-internal/src/state/richtext_state.rs:379 — RichtextState::apply_diff_and_convert 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.
  • RichtextState::find_best_insert_pos (cyclomatic 18) crates/loro-internal/src/container/richtext/richtext_state.rs:1846 — RichtextState::find_best_insert_pos 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.
  • RichtextState::slice_delta (cyclomatic 16) crates/loro-internal/src/container/richtext/richtext_state.rs:2149 — RichtextState::slice_delta 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 · DocState · ×4
  • DocState::apply_diff (cyclomatic 37) crates/loro-internal/src/state.rs:664 — DocState::apply_diff 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.
  • DocState::get_value_by_path (cyclomatic 35) crates/loro-internal/src/state.rs:2575 — DocState::get_value_by_path 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.
  • DocState::ensure_containers_created_by_internal_diff (cyclomatic 21) crates/loro-internal/src/state.rs:938 — DocState::ensure_containers_created_by_internal_diff 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.
  • DocState::get_alive_children_of (cyclomatic 17) crates/loro-internal/src/state.rs:2172 — DocState::get_alive_children_of 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.
D2 · Cognitive Complexity · LoroValue · ×4
  • LoroValue::apply_diff_shallow (cognitive 45) crates/loro-internal/src/value.rs:253 — LoroValue::apply_diff_shallow has cognitive complexity 45 (threshold 15). Drivers by points: loops 6 (18 pts), match/switch 5 (18 pts), if/else 4 (9 pts) (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.
  • LoroValue::apply_diff (cognitive 39) crates/loro-internal/src/value.rs:354 — LoroValue::apply_diff has cognitive complexity 39 (threshold 15). Drivers by points: loops 6 (18 pts), match/switch 5 (18 pts), if/else 2 (3 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • LoroValue::from (cognitive 19) crates/loro-common/src/value.rs:725 — LoroValue::from has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LoroValue::apply (cognitive 17) crates/loro-internal/src/value.rs:444 — LoroValue::apply has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 3 (7 pts), loops 2 (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.
D2 · Cognitive Complexity · RichtextDiffCalculator · ×4
  • RichtextDiffCalculator::apply_crdt_op_to_tracker (cognitive 43) crates/loro-internal/src/diff_calc.rs:1230 — RichtextDiffCalculator::apply_crdt_op_to_tracker has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (10 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RichtextDiffCalculator::seed_tracker_from_shallow_root (cognitive 33) crates/loro-internal/src/diff_calc.rs:1405 — RichtextDiffCalculator::seed_tracker_from_shallow_root has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5, match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RichtextDiffCalculator::calculate_diff (cognitive 30) crates/loro-internal/src/diff_calc.rs:1757 — RichtextDiffCalculator::calculate_diff has cognitive complexity 30 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 4 (9 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 2 function items inside it that branch (push_tracker_chunk, push_tracker_delta_item). 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.
  • RichtextDiffCalculator::apply_change (cognitive 20) crates/loro-internal/src/diff_calc.rs:1654 — RichtextDiffCalculator::apply_change has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 3 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · OpLog · ×4
  • OpLog::try_iter_from_replay_base_causally (cognitive 31) crates/loro-internal/src/oplog.rs:1142 — OpLog::try_iter_from_replay_base_causally has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 4 (6 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.
  • OpLog::uncovered_entry_parents (cognitive 28) crates/loro-internal/src/oplog.rs:891 — OpLog::uncovered_entry_parents has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OpLog::check_known_text_in_cold_block (cognitive 22) crates/loro-internal/src/oplog/known_history.rs:260 — OpLog::check_known_text_in_cold_block 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.
  • OpLog::try_apply_pending (cognitive 21) crates/loro-internal/src/oplog/pending_changes.rs:335 — OpLog::try_apply_pending has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (7 pts), match/switch 1 (4 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.
D31 · IaC & Container Security · Medium IaC · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×4
  • Duplicated block (21 lines × 2) crates/loro-wasm/src/convert.rs:65 — crates/loro-wasm/src/convert.rs:65-85 | crates/loro-wasm/src/convert.rs:330-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) crates/loro-wasm/src/lib.rs:2940 — crates/loro-wasm/src/lib.rs:2940-2960 | crates/loro-wasm/src/lib.rs:2970-2990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:121 — crates/fuzz/src/crdt_fuzzer.rs:121-141 | crates/fuzz/src/one_doc_fuzzer.rs:414-434 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (21 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:1106 — crates/fuzz/src/crdt_fuzzer.rs:1106-1126 | crates/fuzz/src/mem_kv_fuzzer.rs:297-317 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/mem_kv_fuzzer.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · BTree · ×3
  • BTree::handle_lack_single_layer (cyclomatic 22) crates/generic-btree/src/lib.rs:2004 — BTree::handle_lack_single_layer has cyclomatic complexity 22 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • BTree::update_leaf (cyclomatic 21) crates/generic-btree/src/lib.rs:1267 — BTree::update_leaf 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.
  • BTree::update_leaf_by_search (cyclomatic 18) crates/generic-btree/src/lib.rs:1116 — BTree::update_leaf_by_search 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 · RichtextDiffCalculator · ×3
  • RichtextDiffCalculator::calculate_diff (cyclomatic 19) crates/loro-internal/src/diff_calc.rs:1757 — RichtextDiffCalculator::calculate_diff has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (push_tracker_chunk, push_tracker_delta_item). 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.
  • RichtextDiffCalculator::apply_crdt_op_to_tracker (cyclomatic 18) crates/loro-internal/src/diff_calc.rs:1230 — RichtextDiffCalculator::apply_crdt_op_to_tracker 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.
  • RichtextDiffCalculator::seed_tracker_from_shallow_root (cyclomatic 17) crates/loro-internal/src/diff_calc.rs:1405 — RichtextDiffCalculator::seed_tracker_from_shallow_root 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 · AppDag · ×3
  • AppDag::try_ensure_vv_for (cognitive 65) crates/loro-internal/src/oplog/loro_dag.rs:1138 — AppDag::try_ensure_vv_for has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (51 pts), loops 4 (14 pts) (nesting depth added 48). 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.
  • AppDag::lazy_load_nodes_internal (cognitive 28) crates/loro-internal/src/oplog/loro_dag.rs:468 — AppDag::lazy_load_nodes_internal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 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.
  • AppDag::check_dag_correctness (cognitive 25) crates/loro-internal/src/oplog/loro_dag.rs:669 — AppDag::check_dag_correctness has cognitive complexity 25 (threshold 15). Drivers by points: loops 10 (14 pts), if/else 5 (11 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · MovableListHandler · ×3
  • MovableListHandler::unknown_container_created_by_delta (cognitive 49) crates/loro-internal/src/handler/movable_list_apply_delta.rs:295 — MovableListHandler::unknown_container_created_by_delta has cognitive complexity 49 (threshold 15). Drivers by points: if/else 6 (26 pts), loops 5 (17 pts), match/switch 1 (4 pts), boolean chains 2 (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.
  • MovableListHandler::plan_moves (cognitive 45) crates/loro-internal/src/handler/movable_list_apply_delta.rs:90 — MovableListHandler::plan_moves has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (29 pts), loops 5 (14 pts), match/switch 1 (2 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.
  • MovableListHandler::place_inserted_values (cognitive 40) crates/loro-internal/src/handler/movable_list_apply_delta.rs:185 — MovableListHandler::place_inserted_values has cognitive complexity 40 (threshold 15). Drivers by points: if/else 5 (19 pts), match/switch 3 (10 pts), loops 3 (9 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.
D2 · Cognitive Complexity · UndoManager · ×3
  • UndoManager::setOnPush (cognitive 44) crates/loro-wasm/src/lib.rs:5899 — UndoManager::setOnPush has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (28 pts), match/switch 5 (10 pts), loops 1 (6 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.
  • UndoManager::new (cognitive 28) crates/loro-internal/src/undo.rs:687 — UndoManager::new has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • UndoManager::perform (cognitive 21) crates/loro-internal/src/undo.rs:868 — UndoManager::perform has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (3 pts), match/switch 1 (2 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.
D2 · Cognitive Complexity · TextHandler · ×3
  • TextHandler::insert_with_txn_and_attr (cognitive 40) crates/loro-internal/src/handler.rs:2132 — TextHandler::insert_with_txn_and_attr has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), match/switch 5 (8 pts), loops 2 (4 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.
  • TextHandler::convert_pos (cognitive 29) crates/loro-internal/src/handler.rs:2974 — TextHandler::convert_pos has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (24 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextHandler::apply_delta_with_txn (cognitive 22) crates/loro-internal/src/handler.rs:2676 — TextHandler::apply_delta_with_txn has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (11 pts), match/switch 3 (6 pts), if/else 2 (5 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.
D2 · Cognitive Complexity · DeltaRope · ×3
  • DeltaRope::transform_pos (cognitive 27) crates/delta/src/delta_rope.rs:296 — DeltaRope::transform_pos has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (6 pts), boolean chains 3, 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.
  • DeltaRope::eq (cognitive 21) crates/delta/src/delta_rope.rs:346 — DeltaRope::eq has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, 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.
  • DeltaRope::transform (cognitive 16) crates/delta/src/delta_rope.rs:237 — DeltaRope::transform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loro_wasm · ×3
  • loro_wasm::convert::js_value_to_loro_value (cognitive 27) crates/loro-wasm/src/convert.rs:624 — loro_wasm::convert::js_value_to_loro_value has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 3 (7 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.
  • loro_wasm::convert::js_value_to_list_diff (cognitive 25) crates/loro-wasm/src/convert.rs:564 — loro_wasm::convert::js_value_to_list_diff has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • loro_wasm::convert::delta_item_to_js (cognitive 16) crates/loro-wasm/src/convert.rs:275 — loro_wasm::convert::delta_item_to_js has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (5 pts), loops 1 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change coupling · ×3
  • Change coupling: style_range_map.rs ↔ handler.rs crates/loro-internal/src/container/richtext/style_range_map.rs:1 — `crates/loro-internal/src/container/richtext/style_range_map.rs` and `crates/loro-internal/src/handler.rs` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `4b5b460a` fix: skip redundant text marks when the range spans multiple style ra…; `2800a4c8` perf: skip useless unmark op (#878); `3a4ed97e` fix: only send a event for one `import`/`transaction`/`checkout` (#263) — run `git show` on any of them.
  • Change coupling: list_state.rs ↔ map_state.rs crates/loro-internal/src/state/list_state.rs:1 — `crates/loro-internal/src/state/list_state.rs` and `crates/loro-internal/src/state/map_state.rs` change together 51% of the time (19 of the 37 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `3729deb1` feat: richtext snapshot; `b8eb57f4` Refactor ID (#274); `9e57ccbc` Fix avoid rich text apply diff err when time travel (#256) — run `git show` on any of them.
  • Change coupling: kv_store.rs ↔ oplog.rs crates/loro-internal/src/kv_store.rs:1 — `crates/loro-internal/src/kv_store.rs` and `crates/loro-internal/src/oplog.rs` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `9b6330db` perf: speed up B4 local editing ~2.4x and snapshot import ~45% (#1033); `ca6a7c89` fix: warnings; `23fbae1f` refactor: make vv in dag optional — run `git show` on any of them.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/fuzz/src/crdt_fuzzer.rs:962 — crates/fuzz/src/crdt_fuzzer.rs:962-1082 | crates/fuzz/src/crdt_fuzzer.rs:1089-1154 | crates/fuzz/src/mem_kv_fuzzer.rs:280-344 | crates/loro-internal/src/fuzz.rs:8-89 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/generic-btree/src/generic_impl/gap_buffer.rs:191 — crates/generic-btree/src/generic_impl/gap_buffer.rs:191-206 | crates/generic-btree/src/lib.rs:2998-3022 | crates/generic-btree/src/rle.rs:11-25 | crates/generic-btree/src/rle.rs:52-91 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/loro-internal/src/state/richtext_state.rs:131 — crates/loro-internal/src/state/richtext_state.rs:131-149 | crates/loro-internal/src/state/richtext_state.rs:188-214 | crates/loro-internal/src/state/richtext_state.rs:216-265 | crates/loro-internal/src/state/richtext_state.rs:1511-1587 — 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 · Duplicated block (20 lines × 2) · ×3
  • Duplicated block (20 lines × 2) crates/loro-internal/src/oplog/loro_dag.rs:1320 — crates/loro-internal/src/oplog/loro_dag.rs:1320-1339 | crates/loro-internal/src/oplog/loro_dag.rs:1355-1374 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/loro-internal/src/version.rs:571 — crates/loro-internal/src/version.rs:571-590 | crates/loro-internal/src/version.rs:605-624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/loro-internal/src/state/movable_list_state.rs:1671 — crates/loro-internal/src/state/movable_list_state.rs:1671-1690 | crates/loro-internal/src/state/movable_list_state.rs:1766-1785 — both copies are in the same file, so extract the 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 (16 lines × 2) · ×3
  • Duplicated block (16 lines × 2) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:586 — crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:586-601 | crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:644-659 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/loro-internal/src/state/tree_state.rs:1880 — crates/loro-internal/src/state/tree_state.rs:1880-1895 | crates/loro-internal/src/state/tree_state.rs:1897-1912 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:343 — crates/fuzz/src/crdt_fuzzer.rs:343-358 | crates/fuzz/src/one_doc_fuzzer.rs:774-789 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×3
  • Duplicated block (14 lines × 2) crates/loro-internal/src/container/richtext/style_range_map.rs:421 — crates/loro-internal/src/container/richtext/style_range_map.rs:421-434 | crates/loro-internal/src/container/richtext/style_range_map.rs:442-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/loro-internal/src/state/tree_state.rs:1324 — crates/loro-internal/src/state/tree_state.rs:1324-1337 | crates/loro-internal/src/state/tree_state.rs:1373-1386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/fuzz/src/actor.rs:149 — crates/fuzz/src/actor.rs:149-162 | crates/fuzz/src/actor.rs:167-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) crates/kv-store/src/block.rs:484 — crates/kv-store/src/block.rs:484-494 | crates/kv-store/src/block.rs:501-511 | crates/kv-store/src/block.rs:518-528 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) crates/loro-internal/src/handler.rs:737 — crates/loro-internal/src/handler.rs:737-747 | crates/loro-internal/src/handler.rs:868-878 | crates/loro-internal/src/handler.rs:978-988 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) crates/loro-internal/src/value.rs:259 — crates/loro-internal/src/value.rs:259-269 | crates/loro-internal/src/value.rs:295-305 | crates/loro-internal/src/value.rs:360-370 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×3
  • Low cohesion: LoroDoc (LCOM4 27) crates/loro-internal/src/lib.rs:126 — LoroDoc's methods fall into 27 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 27 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: VersionVector (LCOM4 15) crates/loro-internal/src/version.rs:29 — VersionVector's methods fall into 15 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 15 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LoroValueVisitor (LCOM4 5) crates/loro-common/src/value.rs:910 — LoroValueVisitor'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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×3
  • Duplicated block (15 lines × 2 locations) loro-js/src/codec/serde-columnar.ts:370 — loro-js/src/codec/serde-columnar.ts:370 · loro-js/src/codec/serde-columnar.ts:431 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) REDACTED:10816 — REDACTED:10816 · REDACTED:11333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:736 — loro-js/src/runtime/sequence-index.ts:736 · loro-js/src/runtime/sequence-index.ts:840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X3 · Exception handling · Swallowed exception (empty catch) · ×3
  • Swallowed exception (empty catch) crates/loro-wasm/scripts/build.ts:224 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) crates/loro-wasm/scripts/container_id_cache_patch.js:39 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) crates/loro-wasm/scripts/container_id_cache_patch.js:51 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D1 · Cyclomatic Complexity · TextHandler · ×2
  • TextHandler::insert_with_txn_and_attr (cyclomatic 27) crates/loro-internal/src/handler.rs:2132 — TextHandler::insert_with_txn_and_attr 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.
  • TextHandler::convert_pos (cyclomatic 19) crates/loro-internal/src/handler.rs:2974 — TextHandler::convert_pos 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 · ChangeStore · ×2
  • ChangeStore::get_change_by_lamport_lte (cyclomatic 26) crates/loro-internal/src/oplog/change_store.rs:1422 — ChangeStore::get_change_by_lamport_lte 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.
  • ChangeStore::build_root_history_names (cyclomatic 17) crates/loro-internal/src/oplog/change_store.rs:738 — ChangeStore::build_root_history_names 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 · LoroValue · ×2
  • LoroValue::apply (cyclomatic 19) crates/loro-internal/src/value.rs:444 — LoroValue::apply 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.
  • LoroValue::apply_diff_shallow (cyclomatic 16) crates/loro-internal/src/value.rs:253 — LoroValue::apply_diff_shallow 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 · MovableListDiffCalculator · ×2
  • MovableListDiffCalculator::calculate_diff (cyclomatic 17) crates/loro-internal/src/diff_calc.rs:2115 — MovableListDiffCalculator::calculate_diff 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.
  • MovableListDiffCalculator::apply_change (cyclomatic 16) crates/loro-internal/src/diff_calc.rs:2010 — MovableListDiffCalculator::apply_change 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.
D10 · Test Quality · Skipped test · ×2
  • Skipped test: subscription works after timeout crates/loro-wasm/tests/event.test.ts:631 — Skipped — switched off by it.skip
  • Skipped test: subscribe_lock crates/loro-wasm/tests/misc.test.ts:70 — Skipped — switched off by it.skip
D2 · Cognitive Complexity · MovableListState · ×2
  • MovableListState::apply_diff_and_convert (cognitive 97) crates/loro-internal/src/state/movable_list_state.rs:1091 — MovableListState::apply_diff_and_convert has cognitive complexity 97 (threshold 15). Drivers by points: if/else 23 (80 pts), boolean chains 7, match/switch 3 (6 pts), loops 4 (nesting depth added 60). 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.
  • MovableListState::decode_snapshot_fast (cognitive 18) crates/loro-internal/src/state/movable_list_state.rs:1622 — MovableListState::decode_snapshot_fast has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CrdtRope · ×2
  • CrdtRope::insert (cognitive 64) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:63 — CrdtRope::insert has cognitive complexity 64 (threshold 15). Drivers by points: if/else 22 (52 pts), match/switch 2 (8 pts), loops 2 (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.
  • CrdtRope::get_diff (cognitive 16) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:396 — CrdtRope::get_diff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 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.
D2 · Cognitive Complexity · TreeState · ×2
  • TreeState::apply_diff_and_convert (cognitive 49) crates/loro-internal/src/state/tree_state.rs:1196 — TreeState::apply_diff_and_convert has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (40 pts), match/switch 2 (7 pts), loops 1 (2 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TreeState::apply_diff (cognitive 20) crates/loro-internal/src/state/tree_state.rs:1345 — TreeState::apply_diff has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (3 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DagCausalIter · ×2
  • DagCausalIter::next (cognitive 38) crates/loro-internal/src/dag/iter.rs:295 — DagCausalIter::next has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 4 (8 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.
  • DagCausalIter::try_new (cognitive 23) crates/loro-internal/src/dag/iter.rs:205 — DagCausalIter::try_new has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (6 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 · Delta · ×2
  • Delta::compose (cognitive 38) crates/loro-internal/src/delta/seq.rs:522 — Delta::compose has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Delta::push (cognitive 25) crates/loro-internal/src/delta/seq.rs:435 — Delta::push has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, match/switch 1 (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.
D2 · Cognitive Complexity · Rope · ×2
  • Rope::insert (cognitive 34) crates/generic-btree/src/generic_impl/rope.rs:48 — Rope::insert has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • Rope::delete_range (cognitive 20) crates/generic-btree/src/generic_impl/rope.rs:121 — Rope::delete_range has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3, 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.
D2 · Cognitive Complexity · Tracker · ×2
  • Tracker::_checkout (cognitive 28) crates/loro-internal/src/container/richtext/tracker.rs:370 — Tracker::_checkout has cognitive complexity 28 (threshold 15). Drivers by points: match/switch 3 (13 pts), loops 5 (12 pts), if/else 3 (nesting depth added 17). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • Tracker::forward (cognitive 17) crates/loro-internal/src/container/richtext/tracker.rs:484 — Tracker::forward has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (10 pts), loops 3 (7 pts) (nesting depth added 11). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MovableListDiffCalculator · ×2
  • MovableListDiffCalculator::calculate_diff (cognitive 28) crates/loro-internal/src/diff_calc.rs:2115 — MovableListDiffCalculator::calculate_diff has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 2 (4 pts), boolean chains 2, 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.
  • MovableListDiffCalculator::apply_change (cognitive 19) crates/loro-internal/src/diff_calc.rs:2010 — MovableListDiffCalculator::apply_change has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 3 (5 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.
D2 · Cognitive Complexity · ListDiffCalculator · ×2
  • ListDiffCalculator::calculate_diff::handle_unknown (cognitive 26) crates/loro-internal/src/diff_calc.rs:1005 — ListDiffCalculator::calculate_diff::handle_unknown has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (8 pts), match/switch 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ListDiffCalculator::calculate_diff) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • ListDiffCalculator::calculate_diff (cognitive 22) crates/loro-internal/src/diff_calc.rs:921 — ListDiffCalculator::calculate_diff has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (13 pts), match/switch 3 (8 pts), boolean chains 5 (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. This shape REPEATS in the file: one other method here (ListDiffCalculator::calculate_diff::handle_unknown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ListState · ×2
  • ListState::delete_range (cognitive 25) crates/loro-internal/src/state/list_state.rs:397 — ListState::delete_range has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (3 pts), match/switch 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.
  • ListState::validate_diff (cognitive 16) crates/loro-internal/src/state/list_state.rs:585 — ListState::validate_diff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IdToCursor · ×2
  • IdToCursor::update_insert_batch (cognitive 21) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:112 — IdToCursor::update_insert_batch has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 4 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • IdToCursor::iter (cognitive 20) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:202 — IdToCursor::iter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (4 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.
D4 · Code Duplication · Duplicated block (40 lines × 2) · ×2
  • Duplicated block (40 lines × 2) crates/loro-internal/src/handler.rs:3436 — crates/loro-internal/src/handler.rs:3436-3475 | crates/loro-internal/src/handler.rs:4146-4185 — both copies are in the same file, so extract the 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 (40 lines × 2) crates/loro-internal/src/version.rs:401 — crates/loro-internal/src/version.rs:401-440 | crates/loro-internal/src/version.rs:445-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 (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) crates/loro-internal/src/value.rs:957 — crates/loro-internal/src/value.rs:957-974 | crates/loro-internal/src/value.rs:985-1002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/rle/src/rle_vec.rs:301 — crates/rle/src/rle_vec.rs:301-318 | crates/rle/src/rle_vec.rs:396-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) crates/loro-internal/src/loro.rs:3804 — crates/loro-internal/src/loro.rs:3804-3815 | crates/loro-internal/src/oplog/loro_dag.rs:866-876 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–12 lines × 2) crates/loro-wasm-tools/src/main.rs:157 — crates/loro-wasm-tools/src/main.rs:157-168 | crates/loro-wasm-tools/src/main.rs:225-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) crates/loro-internal/src/loro.rs:808 — crates/loro-internal/src/loro.rs:808-816 | crates/loro-internal/src/loro.rs:1034-1041 — both copies are in the same file, so extract the 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–9 lines × 2) crates/fuzz/src/container/tree.rs:391 — crates/fuzz/src/container/tree.rs:391-399 | crates/fuzz/src/one_doc_fuzzer.rs:636-643 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) crates/fuzz/src/crdt_fuzzer.rs:967 — crates/fuzz/src/crdt_fuzzer.rs:967-973 | crates/fuzz/src/crdt_fuzzer.rs:1093-1098 | crates/fuzz/src/mem_kv_fuzzer.rs:284-289 | crates/loro-internal/src/fuzz.rs:12-18 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/mem_kv_fuzzer.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) crates/loro-internal/src/handler.rs:2819 — crates/loro-internal/src/handler.rs:2819-2824 | crates/loro-internal/src/handler.rs:3490-3495 | crates/loro-internal/src/handler.rs:4203-4208 | crates/loro-internal/src/handler/tree.rs:359-364 — before extracting anything, compare `crates/loro-internal/src/handler.rs` and `crates/loro-internal/src/handler/tree.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×2
  • Duplicated block (6 lines × 6) crates/loro-internal/src/handler.rs:536 — crates/loro-internal/src/handler.rs:536-541 | crates/loro-internal/src/handler.rs:765-770 | crates/loro-internal/src/handler.rs:889-894 | crates/loro-internal/src/handler.rs:1006-1011 | crates/loro-internal/src/handler.rs:5125-5130 | crates/loro-internal/src/handler/tree.rs:319-324 — before extracting anything, compare `crates/loro-internal/src/handler.rs` and `crates/loro-internal/src/handler/tree.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 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 × 6) crates/loro-internal/src/handler.rs:2940 — crates/loro-internal/src/handler.rs:2940-2945 | crates/loro-internal/src/handler.rs:3670-3675 | crates/loro-internal/src/handler.rs:4365-4370 | crates/loro-internal/src/handler.rs:4866-4871 | crates/loro-internal/src/handler.rs:5028-5033 | crates/loro-internal/src/handler/tree.rs:1149-1154 — before extracting anything, compare `crates/loro-internal/src/handler.rs` and `crates/loro-internal/src/handler/tree.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 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.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: loro_fractional_index — loro_fractional_index: 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: generic-btree — generic-btree: abstractness 0.24, instability 0.00, distance 0.76 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
R10 · Code Duplication · Duplicated block (26 lines × 2 locations) · ×2
  • Duplicated block (26 lines × 2 locations) loro-js/src/codec/value.ts:134 — loro-js/src/codec/value.ts:134 · loro-js/src/codec/version.ts:9 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (26 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:1530 — loro-js/src/runtime/sequence-index.ts:1530 · loro-js/src/runtime/sequence-index.ts:1557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×2
  • Duplicated block (20 lines × 2 locations) REDACTED:10971 — REDACTED:10971 · loro-js/src/runtime/sequence-index.ts:3540 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (20 lines × 2 locations) loro-js/src/runtime/ephemeral.ts:379 — loro-js/src/runtime/ephemeral.ts:379 · loro-js/src/runtime/ephemeral.ts:401 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×2
  • Duplicated block (16 lines × 2 locations) REDACTED:5949 — REDACTED:5949 · REDACTED:5985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:232 — loro-js/src/runtime/sequence-index.ts:232 · loro-js/src/runtime/sequence-index.ts:525 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (14 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (14 matched lines × 2 locations) loro-js/src/runtime/movable-list.ts:566 — loro-js/src/runtime/movable-list.ts:566 · loro-js/src/runtime/movable-list.ts:682 — the two spans are one implementation copied and then locally edited — 93 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (14 matched lines × 2 locations) loro-js/src/runtime/undo.ts:261 — loro-js/src/runtime/undo.ts:261 · loro-js/src/runtime/undo.ts:319 — the two spans are one implementation copied and then locally edited — 129 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R8 · Dependency Hygiene · Unused dependency '@typescript/native-preview' · ×2
  • Unused dependency '@typescript/native-preview' — Declared in REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
  • Unused dependency '@typescript/native-preview' — Declared in packages/fractional-index/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
D1 · Cyclomatic Complexity · LoroDoc.#importBlob (cyclomatic 81) · ×1
  • LoroDoc.#importBlob (cyclomatic 81) REDACTED:792 — LoroDoc.#importBlob has cyclomatic complexity 81 (threshold 15). Of this number, 77 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#applyVersionTransition (cyclomatic 53) · ×1
  • LoroDoc.#applyVersionTransition (cyclomatic 53) REDACTED:5836 — LoroDoc.#applyVersionTransition 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. This shape REPEATS in the file: one other method here (LoroDoc.#applyVersionTransition::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · LoroDoc.#alignFullState (cyclomatic 50) · ×1
  • LoroDoc.#alignFullState (cyclomatic 50) REDACTED:2127 — LoroDoc.#alignFullState has cyclomatic complexity 50 (threshold 15). Of this number, 46 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#applyMovableListMoves (cyclomatic 47) · ×1
  • LoroDoc.#applyMovableListMoves (cyclomatic 47) REDACTED:1476 — LoroDoc.#applyMovableListMoves has cyclomatic complexity 47 (threshold 15). Of this number, 44 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.
D1 · Cyclomatic Complexity · document.jsonOperationToDecoded (cyclomatic 42) · ×1
  • document.jsonOperationToDecoded (cyclomatic 42) REDACTED:10197 — document.jsonOperationToDecoded has cyclomatic complexity 42 (threshold 15). Of this number, 37 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#prepareEvent (cyclomatic 40) · ×1
  • LoroDoc.#prepareEvent (cyclomatic 40) REDACTED:4686 — LoroDoc.#prepareEvent has cyclomatic complexity 40 (threshold 15). Of this number, 31 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#canTransitionRecords (cyclomatic 38) · ×1
  • LoroDoc.#canTransitionRecords (cyclomatic 38) REDACTED:5733 — LoroDoc.#canTransitionRecords has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#applyVersionTransition · ×1
  • LoroDoc.#applyVersionTransition::collect (cyclomatic 38) REDACTED:5891 — LoroDoc.#applyVersionTransition::collect has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (LoroDoc.#applyVersionTransition) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · LoroDoc.#containerState (cyclomatic 38) · ×1
  • LoroDoc.#containerState (cyclomatic 38) REDACTED:8234 — LoroDoc.#containerState has cyclomatic complexity 38 (threshold 15). Of this number, 25 points are the body's own statements and 13 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MovableListState · ×1
  • MovableListState::apply_diff_and_convert (cyclomatic 37) crates/loro-internal/src/state/movable_list_state.rs:1091 — MovableListState::apply_diff_and_convert 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.
D1 · Cyclomatic Complexity · MovableListState.transition (cyclomatic 37) · ×1
  • MovableListState.transition (cyclomatic 37) loro-js/src/runtime/movable-list.ts:540 — MovableListState.transition has cyclomatic complexity 37 (threshold 15). Of this number, 33 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · LoroDoc.#completeTreeRevivals (cyclomatic 37) · ×1
  • LoroDoc.#completeTreeRevivals (cyclomatic 37) REDACTED:1650 — LoroDoc.#completeTreeRevivals has cyclomatic complexity 37 (threshold 15). Of this number, 29 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#sequenceTreeItems (cyclomatic 34) · ×1
  • LoroDoc.#sequenceTreeItems (cyclomatic 34) REDACTED:1824 — LoroDoc.#sequenceTreeItems has cyclomatic complexity 34 (threshold 15). Of this number, 20 points are the body's own statements and 14 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DiffCalculator · ×1
  • DiffCalculator::try_calc_diff_internal (cyclomatic 33) crates/loro-internal/src/diff_calc.rs:186 — DiffCalculator::try_calc_diff_internal 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 · LoroDoc.#undoOperation (cyclomatic 33) · ×1
  • LoroDoc.#undoOperation (cyclomatic 33) REDACTED:3764 — LoroDoc.#undoOperation 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 · Handler · ×1
  • Handler::apply_diff (cyclomatic 32) crates/loro-internal/src/handler.rs:1352 — Handler::apply_diff has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#undoMovableLists (cyclomatic 32) · ×1
  • LoroDoc.#undoMovableLists (cyclomatic 32) REDACTED:3623 — LoroDoc.#undoMovableLists has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#latestSingleHeadCriticalVersion (cyclomatic 32) · ×1
  • LoroDoc.#latestSingleHeadCriticalVersion (cyclomatic 32) REDACTED:7870 — LoroDoc.#latestSingleHeadCriticalVersion has cyclomatic complexity 32 (threshold 15). Of this number, 18 points are the body's own statements and 14 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · jsonpath.applySelector (cyclomatic 30) · ×1
  • jsonpath.applySelector (cyclomatic 30) loro-js/src/runtime/jsonpath.ts:281 — jsonpath.applySelector 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 · document.decodeImportBlobMeta (cyclomatic 30) · ×1
  • document.decodeImportBlobMeta (cyclomatic 30) REDACTED:8895 — document.decodeImportBlobMeta has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · document.validateTreeItems (cyclomatic 30) · ×1
  • document.validateTreeItems (cyclomatic 30) REDACTED:11160 — document.validateTreeItems has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 6 function items inside it that branch (countOf, checkIndex, alive, …). 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.
D1 · Cyclomatic Complexity · SequenceIndex.insertSpanAtPhysical (cyclomatic 29) · ×1
  • SequenceIndex.insertSpanAtPhysical (cyclomatic 29) loro-js/src/runtime/sequence-index.ts:1104 — SequenceIndex.insertSpanAtPhysical 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 · LoroDoc.diff (cyclomatic 29) · ×1
  • LoroDoc.diff (cyclomatic 29) REDACTED:1263 — LoroDoc.diff has cyclomatic complexity 29 (threshold 15). Of this number, 25 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Model · ×1
  • Model::undo (cyclomatic 28) crates/loro-internal/src/undo/movable_list.rs:470 — Model::undo has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · change-value.encodeChangeValueContent (cyclomatic 28) · ×1
  • change-value.encodeChangeValueContent (cyclomatic 28) loro-js/src/codec/change-value.ts:212 — change-value.encodeChangeValueContent 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.
D1 · Cyclomatic Complexity · MovableListUndoState.apply (cyclomatic 28) · ×1
  • MovableListUndoState.apply (cyclomatic 28) loro-js/src/runtime/movable-list-undo.ts:73 — MovableListUndoState.apply has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContainerHistoryCache · ×1
  • ContainerHistoryCache::init_cache_by_visit_all_change_slow (cyclomatic 27) crates/loro-internal/src/history_cache.rs:163 — ContainerHistoryCache::init_cache_by_visit_all_change_slow 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.
D1 · Cyclomatic Complexity · jsonpath.primitiveCompare (cyclomatic 27) · ×1
  • jsonpath.primitiveCompare (cyclomatic 27) loro-js/src/runtime/jsonpath.ts:766 — jsonpath.primitiveCompare 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.
D1 · Cyclomatic Complexity · ValueReader · ×1
  • ValueReader::recursive_read_value_type_and_content (cyclomatic 26) crates/loro-internal/src/encoding/value.rs:676 — ValueReader::recursive_read_value_type_and_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.
D1 · Cyclomatic Complexity · SequenceIndex.insertAtPhysical (cyclomatic 26) · ×1
  • SequenceIndex.insertAtPhysical (cyclomatic 26) loro-js/src/runtime/sequence-index.ts:1025 — SequenceIndex.insertAtPhysical 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 · LoroDoc.#applyOperation (cyclomatic 26) · ×1
  • LoroDoc.#applyOperation (cyclomatic 26) REDACTED:5167 — LoroDoc.#applyOperation has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LoroDoc.#hydrateContainerState (cyclomatic 26) · ×1
  • LoroDoc.#hydrateContainerState (cyclomatic 26) REDACTED:8545 — LoroDoc.#hydrateContainerState 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 · ListDiffCalculator · ×1
  • ListDiffCalculator::calculate_diff (cyclomatic 25) crates/loro-internal/src/diff_calc.rs:921 — ListDiffCalculator::calculate_diff has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · change-block-codec.decodeOperationContent (cyclomatic 25) · ×1
  • change-block-codec.decodeOperationContent (cyclomatic 25) loro-js/src/codec/change-block-codec.ts:358 — change-block-codec.decodeOperationContent 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.
D1 · Cyclomatic Complexity · sequence-index.recomputeOwnElements (cyclomatic 25) · ×1
  • sequence-index.recomputeOwnElements (cyclomatic 25) loro-js/src/runtime/sequence-index.ts:2947 — sequence-index.recomputeOwnElements 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.
D1 · Cyclomatic Complexity · sequence-index.recomputeOwn (cyclomatic 24) · ×1
  • sequence-index.recomputeOwn (cyclomatic 24) loro-js/src/runtime/sequence-index.ts:2834 — sequence-index.recomputeOwn 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.
D1 · Cyclomatic Complexity · LoroDoc.#validateDiffBatch (cyclomatic 24) · ×1
  • LoroDoc.#validateDiffBatch (cyclomatic 24) REDACTED:2479 — LoroDoc.#validateDiffBatch has cyclomatic complexity 24 (threshold 15). Of this number, 21 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.
D1 · Cyclomatic Complexity · jsonpath.lookupChild (cyclomatic 23) · ×1
  • jsonpath.lookupChild (cyclomatic 23) loro-js/src/runtime/jsonpath.ts:369 — jsonpath.lookupChild 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 · LoroDoc.#rebuildFromSnapshotState (cyclomatic 23) · ×1
  • LoroDoc.#rebuildFromSnapshotState (cyclomatic 23) REDACTED:6676 — LoroDoc.#rebuildFromSnapshotState 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 · UndoManager.#record (cyclomatic 23) · ×1
  • UndoManager.#record (cyclomatic 23) loro-js/src/runtime/undo.ts:239 — UndoManager.#record 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.
D1 · Cyclomatic Complexity · CrdtRope · ×1
  • CrdtRope::insert (cyclomatic 22) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:63 — CrdtRope::insert 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.
D1 · Cyclomatic Complexity · leb128.writeSleb128 (cyclomatic 22) · ×1
  • leb128.writeSleb128 (cyclomatic 22) loro-js/src/codec/leb128.ts:94 — leb128.writeSleb128 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.
D1 · Cyclomatic Complexity · SequenceIndex.causalView (cyclomatic 22) · ×1
  • SequenceIndex.causalView (cyclomatic 22) loro-js/src/runtime/sequence-index.ts:1597 — SequenceIndex.causalView has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (causalCount, a function literal at line 1655, isVisible). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · LoroDoc.#applyContainerDiff (cyclomatic 22) · ×1
  • LoroDoc.#applyContainerDiff (cyclomatic 22) REDACTED:2585 — LoroDoc.#applyContainerDiff 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. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · containers.styleValuesEqual (cyclomatic 22) · ×1
  • containers.styleValuesEqual (cyclomatic 22) loro-js/src/runtime/containers.ts:2491 — containers.styleValuesEqual has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · change-block-codec.encodeChangeBlock (cyclomatic 21) · ×1
  • change-block-codec.encodeChangeBlock (cyclomatic 21) loro-js/src/codec/change-block-codec.ts:234 — change-block-codec.encodeChangeBlock 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 · SstableReader.rewrite (cyclomatic 21) · ×1
  • SstableReader.rewrite (cyclomatic 21) loro-js/src/codec/sstable.ts:162 — SstableReader.rewrite has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sequence-index.visitVisibleStorageRange (cyclomatic 21) · ×1
  • sequence-index.visitVisibleStorageRange (cyclomatic 21) loro-js/src/runtime/sequence-index.ts:3770 — sequence-index.visitVisibleStorageRange has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LoroDoc.#importBlobs (cyclomatic 21) · ×1
  • LoroDoc.#importBlobs (cyclomatic 21) REDACTED:1079 — LoroDoc.#importBlobs has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#recordedEventDiffs (cyclomatic 21) · ×1
  • LoroDoc.#recordedEventDiffs (cyclomatic 21) REDACTED:4922 — LoroDoc.#recordedEventDiffs 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. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#recordsInSpans (cyclomatic 21) · ×1
  • LoroDoc.#recordsInSpans (cyclomatic 21) REDACTED:7326 — LoroDoc.#recordsInSpans 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. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.eventValuesEqual (cyclomatic 21) · ×1
  • document.eventValuesEqual (cyclomatic 21) REDACTED:10924 — document.eventValuesEqual has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SequenceIndex.#markLocatedIdSpanVisibility (cyclomatic 20) · ×1
  • SequenceIndex.#markLocatedIdSpanVisibility (cyclomatic 20) loro-js/src/runtime/sequence-index.ts:1292 — SequenceIndex.#markLocatedIdSpanVisibility has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent 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 · movable-list.runtimeValuesEqual (cyclomatic 20) · ×1
  • movable-list.runtimeValuesEqual (cyclomatic 20) loro-js/src/runtime/movable-list.ts:146 — movable-list.runtimeValuesEqual has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · LoroDoc.#completeDiffEntries (cyclomatic 20) · ×1
  • LoroDoc.#completeDiffEntries (cyclomatic 20) REDACTED:2295 — LoroDoc.#completeDiffEntries has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.getCursorPos (cyclomatic 20) · ×1
  • LoroDoc.getCursorPos (cyclomatic 20) REDACTED:3371 — LoroDoc.getCursorPos has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc._isContainerDeleted (cyclomatic 20) · ×1
  • LoroDoc._isContainerDeleted (cyclomatic 20) REDACTED:3532 — LoroDoc._isContainerDeleted has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.containerDiff (cyclomatic 20) · ×1
  • document.containerDiff (cyclomatic 20) REDACTED:10702 — document.containerDiff has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · containers.indexedFugueInsertion (cyclomatic 20) · ×1
  • containers.indexedFugueInsertion (cyclomatic 20) loro-js/src/runtime/containers.ts:3721 — containers.indexedFugueInsertion has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent 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 · sequence-index.visitVisibleIdRuns (cyclomatic 19) · ×1
  • sequence-index.visitVisibleIdRuns (cyclomatic 19) loro-js/src/runtime/sequence-index.ts:3469 — sequence-index.visitVisibleIdRuns 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 · jsonpath.compileJsonPathEventMatcher (cyclomatic 19) · ×1
  • jsonpath.compileJsonPathEventMatcher (cyclomatic 19) loro-js/src/runtime/jsonpath.ts:66 — jsonpath.compileJsonPathEventMatcher has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 7 function items inside it that branch (positionsAfter, a function literal at line 106, a function literal at line 69, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · LoroDoc.#emit (cyclomatic 19) · ×1
  • LoroDoc.#emit (cyclomatic 19) REDACTED:8781 — LoroDoc.#emit has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.alignText (cyclomatic 19) · ×1
  • document.alignText (cyclomatic 19) REDACTED:11328 — document.alignText has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Delta · ×1
  • Delta::compose (cyclomatic 18) crates/loro-internal/src/delta/seq.rs:522 — Delta::compose 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 · OpLog · ×1
  • OpLog::try_iter_from_replay_base_causally (cyclomatic 18) crates/loro-internal/src/oplog.rs:1142 — OpLog::try_iter_from_replay_base_causally 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 · TreeState · ×1
  • TreeState::apply_diff_and_convert (cyclomatic 18) crates/loro-internal/src/state/tree_state.rs:1196 — TreeState::apply_diff_and_convert 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 · LoroDoc.toJsonWithReplacer (cyclomatic 18) · ×1
  • LoroDoc.toJsonWithReplacer (cyclomatic 18) REDACTED:1207 — LoroDoc.toJsonWithReplacer has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function items inside it that branch (visit, run, a function literal at line 1216, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#mergeTrailingTextDeletes (cyclomatic 18) · ×1
  • LoroDoc.#mergeTrailingTextDeletes (cyclomatic 18) REDACTED:5033 — LoroDoc.#mergeTrailingTextDeletes has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#prepareSnapshotImport (cyclomatic 18) · ×1
  • LoroDoc.#prepareSnapshotImport (cyclomatic 18) REDACTED:6459 — LoroDoc.#prepareSnapshotImport 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#retainedContainerKeys (cyclomatic 18) · ×1
  • LoroDoc.#retainedContainerKeys (cyclomatic 18) REDACTED:8169 — LoroDoc.#retainedContainerKeys has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.containerPath (cyclomatic 18) · ×1
  • document.containerPath (cyclomatic 18) REDACTED:11461 — document.containerPath 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroTree._positionFor (cyclomatic 18) · ×1
  • LoroTree._positionFor (cyclomatic 18) loro-js/src/runtime/containers.ts:3023 — LoroTree._positionFor has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: 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 · SsTableIter · ×1
  • SsTableIter::new_scan (cyclomatic 17) crates/kv-store/src/sstable.rs:642 — SsTableIter::new_scan 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 · ImportedValues · ×1
  • ImportedValues::eq (cyclomatic 17) crates/loro-internal/src/oplog/known_history.rs:36 — ImportedValues::eq 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.
D1 · Cyclomatic Complexity · loro_wasm · ×1
  • loro_wasm::convert::js_value_to_loro_value (cyclomatic 17) crates/loro-wasm/src/convert.rs:624 — loro_wasm::convert::js_value_to_loro_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 · jsonpath.tokenizeFilter (cyclomatic 17) · ×1
  • jsonpath.tokenizeFilter (cyclomatic 17) loro-js/src/runtime/jsonpath.ts:620 — jsonpath.tokenizeFilter 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 · jsonpath.callFilterFunction (cyclomatic 17) · ×1
  • jsonpath.callFilterFunction (cyclomatic 17) loro-js/src/runtime/jsonpath.ts:799 — jsonpath.callFilterFunction 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 · LoroDoc.#commit (cyclomatic 17) · ×1
  • LoroDoc.#commit (cyclomatic 17) REDACTED:506 — LoroDoc.#commit has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#prepareSnapshotTransition (cyclomatic 17) · ×1
  • LoroDoc.#prepareSnapshotTransition (cyclomatic 17) REDACTED:6526 — LoroDoc.#prepareSnapshotTransition has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroDoc.#validateDeferredFrontierBlocks (cyclomatic 17) · ×1
  • LoroDoc.#validateDeferredFrontierBlocks (cyclomatic 17) REDACTED:7118 — LoroDoc.#validateDeferredFrontierBlocks has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.subtractSequenceIdRuns (cyclomatic 17) · ×1
  • document.subtractSequenceIdRuns (cyclomatic 17) REDACTED:10964 — document.subtractSequenceIdRuns has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · LoroText.iter (cyclomatic 17) · ×1
  • LoroText.iter (cyclomatic 17) loro-js/src/runtime/containers.ts:1466 — LoroText.iter has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1497, append, a function literal at line 1537). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · containers.fugueInsertion (cyclomatic 17) · ×1
  • containers.fugueInsertion (cyclomatic 17) loro-js/src/runtime/containers.ts:3598 — containers.fugueInsertion 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 · DagCausalIter · ×1
  • DagCausalIter::next (cyclomatic 16) crates/loro-internal/src/dag/iter.rs:295 — DagCausalIter::next 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 · InnerContent · ×1
  • InnerContent::visit_created_children (cyclomatic 16) crates/loro-internal/src/op/content.rs:28 — InnerContent::visit_created_children 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 · AppDag · ×1
  • AppDag::try_ensure_vv_for (cyclomatic 16) crates/loro-internal/src/oplog/loro_dag.rs:1138 — AppDag::try_ensure_vv_for 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 · ListState · ×1
  • ListState::delete_range (cyclomatic 16) crates/loro-internal/src/state/list_state.rs:397 — ListState::delete_range 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 · UndoManager · ×1
  • UndoManager::setOnPush (cyclomatic 16) crates/loro-wasm/src/lib.rs:5899 — UndoManager::setOnPush 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 · index.LoroDoc.toJsonWithReplacer (cyclomatic 16) · ×1
  • index.LoroDoc.toJsonWithReplacer (cyclomatic 16) crates/loro-wasm/index.ts:337 — index.LoroDoc.toJsonWithReplacer has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (m, run). 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.
D1 · Cyclomatic Complexity · SequenceIndex.compact (cyclomatic 16) · ×1
  • SequenceIndex.compact (cyclomatic 16) loro-js/src/runtime/sequence-index.ts:1734 — SequenceIndex.compact has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (flushElements, appendSpan, a function literal at line 1768). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · SequenceIndex.#appendToPreviousNodeWithLineBreaks (cyclomatic 16) · ×1
  • SequenceIndex.#appendToPreviousNodeWithLineBreaks (cyclomatic 16) loro-js/src/runtime/sequence-index.ts:2143 — SequenceIndex.#appendToPreviousNodeWithLineBreaks 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 · SequenceIndex.#finishSpanAppend (cyclomatic 16) · ×1
  • SequenceIndex.#finishSpanAppend (cyclomatic 16) loro-js/src/runtime/sequence-index.ts:2237 — SequenceIndex.#finishSpanAppend 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 · document.collectJsonPeers (cyclomatic 16) · ×1
  • document.collectJsonPeers (cyclomatic 16) REDACTED:9881 — document.collectJsonPeers has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · document.jsonValueToChangeLoroValue (cyclomatic 16) · ×1
  • document.jsonValueToChangeLoroValue (cyclomatic 16) REDACTED:10439 — document.jsonValueToChangeLoroValue has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent 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: document.decodedOperationToJson (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ephemeral.valueToEncoded (cyclomatic 16) · ×1
  • ephemeral.valueToEncoded (cyclomatic 16) loro-js/src/runtime/ephemeral.ts:539 — ephemeral.valueToEncoded has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
D12 · Dependency Hygiene · Yanked release · ×1
  • Yanked release: lz4_flex — `lz4_flex` resolves to 0.11.5 in the committed REDACTED, and crates.io reports that release as YANKED. A yanked release is one the publisher has withdrawn and asked you to stop using; it keeps resolving only so existing locks do not break. The current stable release is 0.14.0. Run `cargo update -p lz4_flex` and commit the updated lock.
D2 · Cognitive Complexity · LoroDoc.#importBlob (cognitive 145) · ×1
  • LoroDoc.#importBlob (cognitive 145) REDACTED:792 — LoroDoc.#importBlob has cognitive complexity 145 (threshold 15). Drivers by points: if/else 33 (80 pts), loops 8 (26 pts), boolean chains 20, ternaries 8 (19 pts) (nesting depth added 76). Of this number, 142 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#applyVersionTransition (cognitive 123) · ×1
  • LoroDoc.#applyVersionTransition (cognitive 123) REDACTED:5836 — LoroDoc.#applyVersionTransition has cognitive complexity 123 (threshold 15). Drivers by points: if/else 45 (116 pts), loops 24 (49 pts), ternaries 11 (34 pts), boolean chains 22 (nesting depth added 119). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LoroDoc.#applyVersionTransition::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#applyMovableListMoves (cognitive 95) · ×1
  • LoroDoc.#applyMovableListMoves (cognitive 95) REDACTED:1476 — LoroDoc.#applyMovableListMoves has cognitive complexity 95 (threshold 15). Drivers by points: if/else 28 (60 pts), loops 10 (16 pts), ternaries 4 (11 pts), boolean chains 8 (nesting depth added 45). Of this number, 90 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#alignFullState (cognitive 85) · ×1
  • LoroDoc.#alignFullState (cognitive 85) REDACTED:2127 — LoroDoc.#alignFullState has cognitive complexity 85 (threshold 15). Drivers by points: if/else 22 (50 pts), loops 9 (18 pts), boolean chains 15, ternaries 1 (2 pts) (nesting depth added 38). Of this number, 80 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#applyVersionTransition · ×1
  • LoroDoc.#applyVersionTransition::collect (cognitive 84) REDACTED:5891 — LoroDoc.#applyVersionTransition::collect has cognitive complexity 84 (threshold 15). Drivers by points: if/else 20 (61 pts), boolean chains 12, loops 4 (11 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LoroDoc.#applyVersionTransition) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · DiffCalculator · ×1
  • DiffCalculator::try_calc_diff_internal (cognitive 79) crates/loro-internal/src/diff_calc.rs:186 — DiffCalculator::try_calc_diff_internal has cognitive complexity 79 (threshold 15). Drivers by points: if/else 24 (65 pts), loops 6 (9 pts), boolean chains 4, match/switch 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.applySelector (cognitive 77) · ×1
  • jsonpath.applySelector (cognitive 77) loro-js/src/runtime/jsonpath.ts:281 — jsonpath.applySelector has cognitive complexity 77 (threshold 15). Drivers by points: if/else 11 (40 pts), loops 9 (25 pts), ternaries 2 (9 pts), boolean chains 2, match/switch 1 (nesting depth added 52). 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 · LoroDoc.#prepareEvent (cognitive 75) · ×1
  • LoroDoc.#prepareEvent (cognitive 75) REDACTED:4686 — LoroDoc.#prepareEvent has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (47 pts), ternaries 3 (11 pts), loops 3 (9 pts), boolean chains 8 (nesting depth added 37). Of this number, 52 points are the body's own statements and 23 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#canTransitionRecords (cognitive 73) · ×1
  • LoroDoc.#canTransitionRecords (cognitive 73) REDACTED:5733 — LoroDoc.#canTransitionRecords has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (56 pts), loops 5 (9 pts), boolean chains 8 (nesting depth added 38). Of this number, 71 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#containerState (cognitive 72) · ×1
  • LoroDoc.#containerState (cognitive 72) REDACTED:8234 — LoroDoc.#containerState has cognitive complexity 72 (threshold 15). Drivers by points: if/else 22 (43 pts), loops 8 (17 pts), ternaries 4 (11 pts), boolean chains 1 (nesting depth added 37). Of this number, 43 points are the body's own statements and 29 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.jsonOperationToDecoded (cognitive 69) · ×1
  • document.jsonOperationToDecoded (cognitive 69) REDACTED:10197 — document.jsonOperationToDecoded has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (41 pts), ternaries 9 (19 pts), boolean chains 9 (nesting depth added 29). Of this number, 64 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · Model · ×1
  • Model::undo (cognitive 62) crates/loro-internal/src/undo/movable_list.rs:470 — Model::undo has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (49 pts), match/switch 3 (6 pts), boolean chains 4, loops 3 (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.
D2 · Cognitive Complexity · Handler · ×1
  • Handler::apply_diff (cognitive 61) crates/loro-internal/src/handler.rs:1352 — Handler::apply_diff has cognitive complexity 61 (threshold 15). Drivers by points: if/else 11 (35 pts), match/switch 9 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 36). Of this number, 57 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.
D2 · Cognitive Complexity · LoroDoc.#completeTreeRevivals (cognitive 59) · ×1
  • LoroDoc.#completeTreeRevivals (cognitive 59) REDACTED:1650 — LoroDoc.#completeTreeRevivals has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (41 pts), loops 10 (13 pts), boolean chains 5 (nesting depth added 26). Of this number, 49 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#undoMovableLists (cognitive 55) · ×1
  • LoroDoc.#undoMovableLists (cognitive 55) REDACTED:3623 — LoroDoc.#undoMovableLists has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 7 (12 pts), ternaries 3 (8 pts), boolean chains 7 (nesting depth added 25). Of this number, 38 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · ContainerHistoryCache · ×1
  • ContainerHistoryCache::init_cache_by_visit_all_change_slow (cognitive 52) crates/loro-internal/src/history_cache.rs:163 — ContainerHistoryCache::init_cache_by_visit_all_change_slow has cognitive complexity 52 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (12 pts), match/switch 4 (11 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · LoroDoc.#latestSingleHeadCriticalVersion (cognitive 50) · ×1
  • LoroDoc.#latestSingleHeadCriticalVersion (cognitive 50) REDACTED:7870 — LoroDoc.#latestSingleHeadCriticalVersion has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 7 (11 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 22). Of this number, 28 points are the body's own statements and 22 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · MovableListState.transition (cognitive 48) · ×1
  • MovableListState.transition (cognitive 48) loro-js/src/runtime/movable-list.ts:540 — MovableListState.transition has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 11 (18 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 17). Of this number, 44 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.diff (cognitive 48) · ×1
  • LoroDoc.diff (cognitive 48) REDACTED:1263 — LoroDoc.diff has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 3 (7 pts), boolean chains 6, ternaries 3, error handling 2 (nesting depth added 17). Of this number, 44 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#recordsInSpans (cognitive 48) · ×1
  • LoroDoc.#recordsInSpans (cognitive 48) REDACTED:7326 — LoroDoc.#recordsInSpans has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 6 (12 pts), ternaries 2 (8 pts), boolean chains 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.decodeImportBlobMeta (cognitive 47) · ×1
  • document.decodeImportBlobMeta (cognitive 47) REDACTED:8895 — document.decodeImportBlobMeta has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 7 (12 pts), boolean chains 7, ternaries 1 (nesting depth added 18). Of this number, 41 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · SequenceIndex.insertSpanAtPhysical (cognitive 46) · ×1
  • SequenceIndex.insertSpanAtPhysical (cognitive 46) loro-js/src/runtime/sequence-index.ts:1104 — SequenceIndex.insertSpanAtPhysical has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 5 (11 pts), boolean chains 5, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.#completeDiffEntries (cognitive 46) · ×1
  • LoroDoc.#completeDiffEntries (cognitive 46) REDACTED:2295 — LoroDoc.#completeDiffEntries has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 5 (12 pts), boolean chains 6 (nesting depth added 26). Of this number, 43 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#sequenceTreeItems (cognitive 45) · ×1
  • LoroDoc.#sequenceTreeItems (cognitive 45) REDACTED:1824 — LoroDoc.#sequenceTreeItems has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 8 (13 pts), loops 11 (12 pts), boolean chains 3 (nesting depth added 12). Of this number, 29 points are the body's own statements and 16 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#validateDiffBatch (cognitive 45) · ×1
  • LoroDoc.#validateDiffBatch (cognitive 45) REDACTED:2479 — LoroDoc.#validateDiffBatch has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 4 (10 pts), ternaries 2 (7 pts), boolean chains 4 (nesting depth added 23). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#hydrateContainerState (cognitive 45) · ×1
  • LoroDoc.#hydrateContainerState (cognitive 45) REDACTED:8545 — LoroDoc.#hydrateContainerState has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 8 (17 pts), boolean chains 6 (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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.validateTreeItems (cognitive 44) · ×1
  • document.validateTreeItems (cognitive 44) REDACTED:11160 — document.validateTreeItems has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (7 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 19). Of this number, 30 points are the body's own statements and 14 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · MovableListUndoState.apply (cognitive 43) · ×1
  • MovableListUndoState.apply (cognitive 43) loro-js/src/runtime/movable-list-undo.ts:73 — MovableListUndoState.apply has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, loops 5 (7 pts), ternaries 2 (7 pts) (nesting depth added 18). Of this number, 42 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.#applyContainerDiff (cognitive 43) · ×1
  • LoroDoc.#applyContainerDiff (cognitive 43) REDACTED:2585 — LoroDoc.#applyContainerDiff has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (36 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · sequence-index.recomputeOwnElements (cognitive 41) · ×1
  • sequence-index.recomputeOwnElements (cognitive 41) loro-js/src/runtime/sequence-index.ts:2947 — sequence-index.recomputeOwnElements has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (32 pts), ternaries 4 (6 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · change-block-codec.decodeOperationContent (cognitive 40) · ×1
  • change-block-codec.decodeOperationContent (cognitive 40) loro-js/src/codec/change-block-codec.ts:358 — change-block-codec.decodeOperationContent has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (33 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SstableReader.rewrite (cognitive 40) · ×1
  • SstableReader.rewrite (cognitive 40) loro-js/src/codec/sstable.ts:162 — SstableReader.rewrite has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 4 (10 pts), loops 5 (8 pts), boolean chains 4 (nesting depth added 19). Of this number, 37 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.insertAtPhysical (cognitive 40) · ×1
  • SequenceIndex.insertAtPhysical (cognitive 40) loro-js/src/runtime/sequence-index.ts:1025 — SequenceIndex.insertAtPhysical has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (25 pts), loops 4 (9 pts), boolean chains 5, ternaries 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 · sequence-index.recomputeOwn (cognitive 38) · ×1
  • sequence-index.recomputeOwn (cognitive 38) loro-js/src/runtime/sequence-index.ts:2834 — sequence-index.recomputeOwn has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 3 (5 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 · sequence-index.visitVisibleStorageRange (cognitive 38) · ×1
  • sequence-index.visitVisibleStorageRange (cognitive 38) loro-js/src/runtime/sequence-index.ts:3770 — sequence-index.visitVisibleStorageRange has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 18). Of this number, 36 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.
D2 · Cognitive Complexity · ValueReader · ×1
  • ValueReader::recursive_read_value_type_and_content (cognitive 37) crates/loro-internal/src/encoding/value.rs:676 — ValueReader::recursive_read_value_type_and_content has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (25 pts), match/switch 5 (11 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.
D2 · Cognitive Complexity · LoroDoc.#recordedEventDiffs (cognitive 37) · ×1
  • LoroDoc.#recordedEventDiffs (cognitive 37) REDACTED:4922 — LoroDoc.#recordedEventDiffs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, loops 3 (7 pts), ternaries 1 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · containers.indexedFugueInsertion (cognitive 37) · ×1
  • containers.indexedFugueInsertion (cognitive 37) loro-js/src/runtime/containers.ts:3721 — containers.indexedFugueInsertion has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (5 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 16). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.#importBlobs (cognitive 36) · ×1
  • LoroDoc.#importBlobs (cognitive 36) REDACTED:1079 — LoroDoc.#importBlobs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 4 (9 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#rebuildFromSnapshotState (cognitive 36) · ×1
  • LoroDoc.#rebuildFromSnapshotState (cognitive 36) REDACTED:6676 — LoroDoc.#rebuildFromSnapshotState has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (8 pts), ternaries 3 (7 pts), boolean chains 6 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#retainedContainerKeys (cognitive 36) · ×1
  • LoroDoc.#retainedContainerKeys (cognitive 36) REDACTED:8169 — LoroDoc.#retainedContainerKeys has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 6 (14 pts), boolean chains 1 (nesting depth added 19). Of this number, 34 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.subtractSequenceIdRuns (cognitive 34) · ×1
  • document.subtractSequenceIdRuns (cognitive 34) REDACTED:10964 — document.subtractSequenceIdRuns has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 6 (9 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · Drain · ×1
  • Drain::drop (cognitive 33) crates/generic-btree/src/iter.rs:135 — Drain::drop has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 6 (12 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.#markLocatedIdSpanVisibility (cognitive 33) · ×1
  • SequenceIndex.#markLocatedIdSpanVisibility (cognitive 33) loro-js/src/runtime/sequence-index.ts:1292 — SequenceIndex.#markLocatedIdSpanVisibility has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 8 (13 pts), ternaries 1 (nesting depth added 14). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent 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 · LoroDoc.#integrateHistory (cognitive 33) · ×1
  • LoroDoc.#integrateHistory (cognitive 33) REDACTED:5503 — LoroDoc.#integrateHistory has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · MemKvStore · ×1
  • MemKvStore::export_with_encoded_block (cognitive 32) crates/kv-store/src/mem_store.rs:309 — MemKvStore::export_with_encoded_block has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 5 (9 pts), match/switch 1 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.lookupChild (cognitive 32) · ×1
  • jsonpath.lookupChild (cognitive 32) loro-js/src/runtime/jsonpath.ts:369 — jsonpath.lookupChild has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 7 (14 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.causalView (cognitive 30) · ×1
  • SequenceIndex.causalView (cognitive 30) loro-js/src/runtime/sequence-index.ts:1597 — SequenceIndex.causalView has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 10). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1655, causalCount, isVisible). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · LoroDoc.#emit (cognitive 30) · ×1
  • LoroDoc.#emit (cognitive 30) REDACTED:8781 — LoroDoc.#emit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6 (10 pts), boolean chains 2, ternaries 2 (nesting depth added 11). Of this number, 28 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.containerPath (cognitive 30) · ×1
  • document.containerPath (cognitive 30) REDACTED:11461 — document.containerPath has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (6 pts), boolean chains 3, 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · jsonpath.compileJsonPathEventMatcher (cognitive 29) · ×1
  • jsonpath.compileJsonPathEventMatcher (cognitive 29) loro-js/src/runtime/jsonpath.ts:66 — jsonpath.compileJsonPathEventMatcher has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 12). None of this is in the body itself: all 29 points belong to 7 function items inside it that branch (positionsAfter, a function literal at line 106, a function literal at line 69, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · jsonpath.primitiveCompare (cognitive 29) · ×1
  • jsonpath.primitiveCompare (cognitive 29) loro-js/src/runtime/jsonpath.ts:766 — jsonpath.primitiveCompare has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 10, ternaries 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LoroDoc.#undoOperation (cognitive 29) · ×1
  • LoroDoc.#undoOperation (cognitive 29) REDACTED:3764 — LoroDoc.#undoOperation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (5 pts), boolean chains 4, 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#validateDeferredFrontierBlocks (cognitive 29) · ×1
  • LoroDoc.#validateDeferredFrontierBlocks (cognitive 29) REDACTED:7118 — LoroDoc.#validateDeferredFrontierBlocks has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#prepareSnapshotTransition (cognitive 28) · ×1
  • LoroDoc.#prepareSnapshotTransition (cognitive 28) REDACTED:6526 — LoroDoc.#prepareSnapshotTransition has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 5, loops 3 (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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · SsTableIter · ×1
  • SsTableIter::new_scan (cognitive 27) crates/kv-store/src/sstable.rs:642 — SsTableIter::new_scan has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 2, match/switch 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 · Plan · ×1
  • Plan::apply_native (cognitive 27) crates/loro-internal/src/undo/movable_list.rs:763 — Plan::apply_native has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 3 (9 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.
D2 · Cognitive Complexity · leb128.writeSleb128 (cognitive 27) · ×1
  • leb128.writeSleb128 (cognitive 27) loro-js/src/codec/leb128.ts:94 — leb128.writeSleb128 has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (9 pts), ternaries 4 (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.
D2 · Cognitive Complexity · change-block-codec.encodeChangeBlock (cognitive 27) · ×1
  • change-block-codec.encodeChangeBlock (cognitive 27) loro-js/src/codec/change-block-codec.ts:234 — change-block-codec.encodeChangeBlock has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 5 (7 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.
D2 · Cognitive Complexity · SequenceIndex.visibleIndexOfWidthElement (cognitive 27) · ×1
  • SequenceIndex.visibleIndexOfWidthElement (cognitive 27) loro-js/src/runtime/sequence-index.ts:800 — SequenceIndex.visibleIndexOfWidthElement has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (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.
D2 · Cognitive Complexity · sequence-index.visitVisibleIdRuns (cognitive 27) · ×1
  • sequence-index.visitVisibleIdRuns (cognitive 27) loro-js/src/runtime/sequence-index.ts:3469 — sequence-index.visitVisibleIdRuns has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.tokenizeFilter (cognitive 27) · ×1
  • jsonpath.tokenizeFilter (cognitive 27) loro-js/src/runtime/jsonpath.ts:620 — jsonpath.tokenizeFilter has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.callFilterFunction (cognitive 27) · ×1
  • jsonpath.callFilterFunction (cognitive 27) loro-js/src/runtime/jsonpath.ts:799 — jsonpath.callFilterFunction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 3 (6 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 · LoroDoc.#planSnapshotStates (cognitive 27) · ×1
  • LoroDoc.#planSnapshotStates (cognitive 27) REDACTED:6763 — LoroDoc.#planSnapshotStates has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · containers.fugueDescendsFrom (cognitive 27) · ×1
  • containers.fugueDescendsFrom (cognitive 27) loro-js/src/runtime/containers.ts:3814 — containers.fugueDescendsFrom has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
D2 · Cognitive Complexity · DeleteSpanWithId · ×1
  • DeleteSpanWithId::is_mergable (cognitive 26) crates/loro-internal/src/container/list/list_op.rs:217 — DeleteSpanWithId::is_mergable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InsertSet · ×1
  • InsertSet::update_many (cognitive 26) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:423 — InsertSet::update_many has cognitive complexity 26 (threshold 15). Drivers by points: loops 8 (17 pts), if/else 6 (8 pts), match/switch 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TreeDiff · ×1
  • TreeDiff::try_from (cognitive 26) crates/loro-internal/src/value.rs:871 — TreeDiff::try_from has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, 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 · LoroDoc.#applyTreeDiff (cognitive 26) · ×1
  • LoroDoc.#applyTreeDiff (cognitive 26) REDACTED:2693 — LoroDoc.#applyTreeDiff has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). Of this number, 23 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.containerDiff (cognitive 26) · ×1
  • document.containerDiff (cognitive 26) REDACTED:10702 — document.containerDiff has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 5 (10 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.jsonValueToChangeLoroValue (cognitive 25) · ×1
  • document.jsonValueToChangeLoroValue (cognitive 25) REDACTED:10439 — document.jsonValueToChangeLoroValue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 10). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroText.#insertOverrides (cognitive 25) · ×1
  • LoroText.#insertOverrides (cognitive 25) loro-js/src/runtime/containers.ts:2291 — LoroText.#insertOverrides has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (9 pts), boolean chains 4 (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 · DagIteratorVV · ×1
  • DagIteratorVV::next (cognitive 24) crates/loro-internal/src/dag/iter.rs:111 — DagIteratorVV::next has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), 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.
D2 · Cognitive Complexity · index.LoroDoc.toJsonWithReplacer · ×1
  • index.LoroDoc.toJsonWithReplacer::m (cognitive 24) crates/loro-wasm/index.ts:345 — index.LoroDoc.toJsonWithReplacer::m has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3 (nesting depth added 12). 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 · leb128.readSleb128 (cognitive 24) · ×1
  • leb128.readSleb128 (cognitive 24) loro-js/src/codec/leb128.ts:56 — leb128.readSleb128 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), ternaries 1 (3 pts), boolean chains 2, loops 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 · LoroDoc.#attachedChildren (cognitive 24) · ×1
  • LoroDoc.#attachedChildren (cognitive 24) REDACTED:2372 — LoroDoc.#attachedChildren has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 11). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#prepareSnapshotImport (cognitive 24) · ×1
  • LoroDoc.#prepareSnapshotImport (cognitive 24) REDACTED:6459 — LoroDoc.#prepareSnapshotImport has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.recoverParentBinding (cognitive 24) · ×1
  • document.recoverParentBinding (cognitive 24) REDACTED:11419 — document.recoverParentBinding has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (8 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroText.iter (cognitive 24) · ×1
  • LoroText.iter (cognitive 24) loro-js/src/runtime/containers.ts:1466 — LoroText.iter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1497, append, a function literal at line 1537). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · containers.scannedFugueInsertion (cognitive 24) · ×1
  • containers.scannedFugueInsertion (cognitive 24) loro-js/src/runtime/containers.ts:3672 — containers.scannedFugueInsertion has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · UndoManager.#record (cognitive 24) · ×1
  • UndoManager.#record (cognitive 24) loro-js/src/runtime/undo.ts:239 — UndoManager.#record has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 4 (8 pts), boolean chains 6 (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 · MemStoreIterator · ×1
  • MemStoreIterator::next (cognitive 23) crates/kv-store/src/mem_store.rs:442 — MemStoreIterator::next has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextChunk · ×1
  • TextChunk::_slice (cognitive 23) crates/loro-internal/src/container/richtext/richtext_state.rs:583 — TextChunk::_slice has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (5 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 · SequenceIndex.compact (cognitive 23) · ×1
  • SequenceIndex.compact (cognitive 23) loro-js/src/runtime/sequence-index.ts:1734 — SequenceIndex.compact has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 2 (6 pts), boolean chains 3, loops 2 (nesting depth added 6). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (flushElements, a function literal at line 1768, appendSpan). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SequenceIndex.#finishSpanAppend (cognitive 23) · ×1
  • SequenceIndex.#finishSpanAppend (cognitive 23) loro-js/src/runtime/sequence-index.ts:2237 — SequenceIndex.#finishSpanAppend has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 3 (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.
D2 · Cognitive Complexity · LoroDoc.#deleteInsertedElements (cognitive 23) · ×1
  • LoroDoc.#deleteInsertedElements (cognitive 23) REDACTED:3854 — LoroDoc.#deleteInsertedElements has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#restoreDeletedElements (cognitive 23) · ×1
  • LoroDoc.#restoreDeletedElements (cognitive 23) REDACTED:3896 — LoroDoc.#restoreDeletedElements has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 9). Of this number, 17 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.alignText (cognitive 23) · ×1
  • document.alignText (cognitive 23) REDACTED:11328 — document.alignText has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (6 pts), boolean chains 3, ternaries 2 (nesting depth added 6). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · DeltaItem · ×1
  • DeltaItem::update_with_split (cognitive 22) crates/delta/src/delta_item.rs:213 — DeltaItem::update_with_split has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 3 (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 · ArenaContainers · ×1
  • ArenaContainers::get_depth (cognitive 22) crates/loro-internal/src/arena.rs:213 — ArenaContainers::get_depth has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, match/switch 1 (nesting depth added 10). 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 · lz4.decodeLz4Frame (cognitive 22) · ×1
  • lz4.decodeLz4Frame (cognitive 22) loro-js/src/codec/lz4.ts:20 — lz4.decodeLz4Frame has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 1 (3 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 · SequenceDeletionIndex.hasDeletionAt (cognitive 22) · ×1
  • SequenceDeletionIndex.hasDeletionAt (cognitive 22) loro-js/src/runtime/sequence-deletion-index.ts:132 — SequenceDeletionIndex.hasDeletionAt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts), ternaries 1 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.zeroWidthBeforeVisibleIndex (cognitive 22) · ×1
  • SequenceIndex.zeroWidthBeforeVisibleIndex (cognitive 22) loro-js/src/runtime/sequence-index.ts:764 — SequenceIndex.zeroWidthBeforeVisibleIndex has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.visibleIndexAfterLineBreaks (cognitive 22) · ×1
  • SequenceIndex.visibleIndexAfterLineBreaks (cognitive 22) loro-js/src/runtime/sequence-index.ts:936 — SequenceIndex.visibleIndexAfterLineBreaks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 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.
D2 · Cognitive Complexity · TextStyleIndex.replacedRuns (cognitive 22) · ×1
  • TextStyleIndex.replacedRuns (cognitive 22) loro-js/src/runtime/text-style-index.ts:183 — TextStyleIndex.replacedRuns has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SmallInsertSet · ×1
  • SmallInsertSet::update (cognitive 21) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:691 — SmallInsertSet::update has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.visibleIndexOfMetricUnit (cognitive 21) · ×1
  • SequenceIndex.visibleIndexOfMetricUnit (cognitive 21) loro-js/src/runtime/sequence-index.ts:839 — SequenceIndex.visibleIndexOfMetricUnit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), ternaries 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.
D2 · Cognitive Complexity · SequenceIndex.visibleAtMetricOffset (cognitive 21) · ×1
  • SequenceIndex.visibleAtMetricOffset (cognitive 21) loro-js/src/runtime/sequence-index.ts:898 — SequenceIndex.visibleAtMetricOffset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), ternaries 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.
D2 · Cognitive Complexity · MovableListState.canTransition (cognitive 21) · ×1
  • MovableListState.canTransition (cognitive 21) loro-js/src/runtime/movable-list.ts:670 — MovableListState.canTransition has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MovableListState.hydrate (cognitive 21) · ×1
  • MovableListState.hydrate (cognitive 21) loro-js/src/runtime/movable-list.ts:799 — MovableListState.hydrate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (6 pts), loops 3 (4 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.#installTreeMoves (cognitive 21) · ×1
  • LoroDoc.#installTreeMoves (cognitive 21) REDACTED:6400 — LoroDoc.#installTreeMoves has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.collectJsonPeers (cognitive 21) · ×1
  • document.collectJsonPeers (cognitive 21) REDACTED:9881 — document.collectJsonPeers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 7). Of this number, 17 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.validateListDelta (cognitive 21) · ×1
  • document.validateListDelta (cognitive 21) REDACTED:11267 — document.validateListDelta has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.redactDeadStyleValues (cognitive 21) · ×1
  • document.redactDeadStyleValues (cognitive 21) REDACTED:11546 — document.redactDeadStyleValues has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · containers.fugueInsertion (cognitive 21) · ×1
  • containers.fugueInsertion (cognitive 21) loro-js/src/runtime/containers.ts:3598 — containers.fugueInsertion has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NormalBlock · ×1
  • NormalBlock::validate_decoded_data (cognitive 20) crates/kv-store/src/block.rs:166 — NormalBlock::validate_decoded_data has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build.build (cognitive 20) · ×1
  • build.build (cognitive 20) crates/loro-wasm/scripts/build.ts:59 — build.build has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 1 (3 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 · change-block-tables.encodeChangesHeader (cognitive 20) · ×1
  • change-block-tables.encodeChangesHeader (cognitive 20) loro-js/src/codec/change-block-tables.ts:181 — change-block-tables.encodeChangesHeader has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.nextVisible (cognitive 20) · ×1
  • SequenceIndex.nextVisible (cognitive 20) loro-js/src/runtime/sequence-index.ts:1530 — SequenceIndex.nextVisible has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SequenceIndex.previousVisible) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SequenceIndex.previousVisible (cognitive 20) · ×1
  • SequenceIndex.previousVisible (cognitive 20) loro-js/src/runtime/sequence-index.ts:1557 — SequenceIndex.previousVisible has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SequenceIndex.nextVisible) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · jsonpath.readFilterPath (cognitive 20) · ×1
  • jsonpath.readFilterPath (cognitive 20) loro-js/src/runtime/jsonpath.ts:683 — jsonpath.readFilterPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.toJsonWithReplacer (cognitive 20) · ×1
  • LoroDoc.toJsonWithReplacer (cognitive 20) REDACTED:1207 — LoroDoc.toJsonWithReplacer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 6). None of this is in the body itself: all 20 points belong to 4 function items inside it that branch (visit, run, a function literal at line 1216, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroText.applyDelta (cognitive 20) · ×1
  • LoroText.applyDelta (cognitive 20) loro-js/src/runtime/containers.ts:1652 — LoroText.applyDelta has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ListHandler · ×1
  • ListHandler::apply_delta (cognitive 19) crates/loro-internal/src/handler.rs:3613 — ListHandler::apply_delta has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 3 (9 pts), loops 2 (6 pts), if/else 1 (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.
D2 · Cognitive Complexity · InnerContent · ×1
  • InnerContent::visit_created_children (cognitive 19) crates/loro-internal/src/op/content.rs:28 — InnerContent::visit_created_children has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (5 pts), loops 1 (3 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · sstable.encodeBlocks (cognitive 19) · ×1
  • sstable.encodeBlocks (cognitive 19) loro-js/src/codec/sstable.ts:308 — sstable.encodeBlocks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.#appendToPreviousNodeWithLineBreaks (cognitive 19) · ×1
  • SequenceIndex.#appendToPreviousNodeWithLineBreaks (cognitive 19) loro-js/src/runtime/sequence-index.ts:2143 — SequenceIndex.#appendToPreviousNodeWithLineBreaks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (3 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.
D2 · Cognitive Complexity · sequence-index.findNextIncludedPhysical (cognitive 19) · ×1
  • sequence-index.findNextIncludedPhysical (cognitive 19) loro-js/src/runtime/sequence-index.ts:2476 — sequence-index.findNextIncludedPhysical has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 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.
D2 · Cognitive Complexity · FilterParser.#parsePrimary (cognitive 19) · ×1
  • FilterParser.#parsePrimary (cognitive 19) loro-js/src/runtime/jsonpath.ts:552 — FilterParser.#parsePrimary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (6 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoroDoc.#commit (cognitive 19) · ×1
  • LoroDoc.#commit (cognitive 19) REDACTED:506 — LoroDoc.#commit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (5 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.getCursorPos (cognitive 19) · ×1
  • LoroDoc.getCursorPos (cognitive 19) REDACTED:3371 — LoroDoc.getCursorPos has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#applyChange (cognitive 19) · ×1
  • LoroDoc.#applyChange (cognitive 19) REDACTED:5672 — LoroDoc.#applyChange has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · Iter · ×1
  • Iter::next_with (cognitive 18) crates/delta/src/iter.rs:62 — Iter::next_with has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TreeDiffCalculator · ×1
  • TreeDiffCalculator::checkout_diff (cognitive 18) crates/loro-internal/src/diff_calc/tree.rs:205 — TreeDiffCalculator::checkout_diff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
D2 · Cognitive Complexity · TextDelta · ×1
  • TextDelta::from_text_diff (cognitive 18) crates/loro-internal/src/handler.rs:574 — TextDelta::from_text_diff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 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 · RichtextStateLoader · ×1
  • RichtextStateLoader::try_apply_append_delta (cognitive 18) crates/loro-internal/src/state/richtext_state.rs:1197 — RichtextStateLoader::try_apply_append_delta has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VersionVector · ×1
  • VersionVector::partial_cmp (cognitive 18) crates/loro-internal/src/version.rs:400 — VersionVector::partial_cmp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ImVersionVector::partial_cmp) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ImVersionVector · ×1
  • ImVersionVector::partial_cmp (cognitive 18) crates/loro-internal/src/version.rs:444 — ImVersionVector::partial_cmp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (VersionVector::partial_cmp) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SequenceEventDiff.#textDelta (cognitive 18) · ×1
  • SequenceEventDiff.#textDelta (cognitive 18) loro-js/src/runtime/event-diff.ts:105 — SequenceEventDiff.#textDelta has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceIndex.#appendToPreviousNode (cognitive 18) · ×1
  • SequenceIndex.#appendToPreviousNode (cognitive 18) loro-js/src/runtime/sequence-index.ts:2079 — SequenceIndex.#appendToPreviousNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · movable-list.runtimeValuesEqual (cognitive 18) · ×1
  • movable-list.runtimeValuesEqual (cognitive 18) loro-js/src/runtime/movable-list.ts:146 — movable-list.runtimeValuesEqual has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · jsonpath.parseBracketSelector (cognitive 18) · ×1
  • jsonpath.parseBracketSelector (cognitive 18) loro-js/src/runtime/jsonpath.ts:210 — jsonpath.parseBracketSelector has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). Of this number, 14 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.
D2 · Cognitive Complexity · document.eventValuesEqual (cognitive 18) · ×1
  • document.eventValuesEqual (cognitive 18) REDACTED:10924 — document.eventValuesEqual has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · TextStyleIndex.everyWinner (cognitive 18) · ×1
  • TextStyleIndex.everyWinner (cognitive 18) loro-js/src/runtime/text-style-index.ts:111 — TextStyleIndex.everyWinner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 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.
D2 · Cognitive Complexity · Change · ×1
  • Change::slice (cognitive 17) crates/loro-internal/src/change.rs:203 — Change::slice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (3 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 · measure-snapshot-round-memory.runCoordinator (cognitive 17) · ×1
  • measure-snapshot-round-memory.runCoordinator (cognitive 17) crates/loro-wasm/scripts/measure-snapshot-round-memory.cjs:313 — measure-snapshot-round-memory.runCoordinator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1, ternaries 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.
D2 · Cognitive Complexity · sequence-index.markIdRunsDeleted (cognitive 17) · ×1
  • sequence-index.markIdRunsDeleted (cognitive 17) loro-js/src/runtime/sequence-index.ts:3658 — sequence-index.markIdRunsDeleted 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. This shape REPEATS in the file: one other method here (sequence-index.markIdRunsVisible) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · sequence-index.markIdRunsVisible (cognitive 17) · ×1
  • sequence-index.markIdRunsVisible (cognitive 17) loro-js/src/runtime/sequence-index.ts:3714 — sequence-index.markIdRunsVisible 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. This shape REPEATS in the file: one other method here (sequence-index.markIdRunsDeleted) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · jsonpath.readBracket (cognitive 17) · ×1
  • jsonpath.readBracket (cognitive 17) loro-js/src/runtime/jsonpath.ts:180 — jsonpath.readBracket has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.sliceIndexedValues (cognitive 17) · ×1
  • jsonpath.sliceIndexedValues (cognitive 17) loro-js/src/runtime/jsonpath.ts:459 — jsonpath.sliceIndexedValues has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 4, loops 2 (4 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: 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 · jsonpath.splitTopLevel (cognitive 17) · ×1
  • jsonpath.splitTopLevel (cognitive 17) loro-js/src/runtime/jsonpath.ts:863 — jsonpath.splitTopLevel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 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 · LoroDoc.#atomically (cognitive 17) · ×1
  • LoroDoc.#atomically (cognitive 17) REDACTED:5365 — LoroDoc.#atomically has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 4 (6 pts), loops 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc.#indexHistoryOperations (cognitive 17) · ×1
  • LoroDoc.#indexHistoryOperations (cognitive 17) REDACTED:7059 — LoroDoc.#indexHistoryOperations 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. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · containers.recordFugueOriginEntry (cognitive 17) · ×1
  • containers.recordFugueOriginEntry (cognitive 17) loro-js/src/runtime/containers.ts:3925 — containers.recordFugueOriginEntry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 1 (2 pts), ternaries 2, 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 · ephemeral.valueToEncoded (cognitive 17) · ×1
  • ephemeral.valueToEncoded (cognitive 17) loro-js/src/runtime/ephemeral.ts:539 — ephemeral.valueToEncoded has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 3). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · generic_btree · ×1
  • generic_btree::iter::handle_lack_on_path_to_leaf (cognitive 16) crates/generic-btree/src/iter.rs:263 — generic_btree::iter::handle_lack_on_path_to_leaf has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 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.
D2 · Cognitive Complexity · MapDiff · ×1
  • MapDiff::compose (cognitive 16) crates/loro-internal/src/delta/map.rs:43 — MapDiff::compose has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 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 · SubscriberSet · ×1
  • SubscriberSet::retain (cognitive 16) crates/loro-internal/src/utils/subscription.rs:409 — SubscriberSet::retain has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 5). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · loro_wasm_tools · ×1
  • loro_wasm_tools::strip_custom (cognitive 16) crates/loro-wasm-tools/src/main.rs:182 — loro_wasm_tools::strip_custom has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SstableReader.get (cognitive 16) · ×1
  • SstableReader.get (cognitive 16) loro-js/src/codec/sstable.ts:130 — SstableReader.get has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonpath.parseJsonPath (cognitive 16) · ×1
  • jsonpath.parseJsonPath (cognitive 16) loro-js/src/runtime/jsonpath.ts:142 — jsonpath.parseJsonPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 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 · jsonpath.sliceValues (cognitive 16) · ×1
  • jsonpath.sliceValues (cognitive 16) loro-js/src/runtime/jsonpath.ts:431 — jsonpath.sliceValues has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (9 pts), loops 2 (4 pts), if/else 3 (nesting depth added 4). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, 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 · LoroDoc._isContainerDeleted (cognitive 16) · ×1
  • LoroDoc._isContainerDeleted (cognitive 16) REDACTED:3532 — LoroDoc._isContainerDeleted has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · LoroDoc._undoIdSpan (cognitive 16) · ×1
  • LoroDoc._undoIdSpan (cognitive 16) REDACTED:3576 — LoroDoc._undoIdSpan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · document.restoreBlueprint (cognitive 16) · ×1
  • document.restoreBlueprint (cognitive 16) REDACTED:10544 — document.restoreBlueprint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: REDACTED holds 56 of the 289 methods over the threshold — including the worst — and 1420 of the 4955 points over it (29%), 4.5× the next-largest file (crates/loro-internal/src/loro.rs at 314). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · TextStyleIndex.transitions (cognitive 16) · ×1
  • TextStyleIndex.transitions (cognitive 16) loro-js/src/runtime/text-style-index.ts:271 — TextStyleIndex.transitions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (49 shared lines) · ×1
  • Near-duplicate member pair (49 shared lines) crates/loro-internal/src/value.rs:253 — crates/loro-internal/src/value.rs:253-352 | crates/loro-internal/src/value.rs:354-442 — These two members are variants of one another: 49 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/loro-wasm/src/counter.rs:71 — crates/loro-wasm/src/counter.rs:71-84 | crates/loro-wasm/src/lib.rs:3270-3284 | crates/loro-wasm/src/lib.rs:3831-3845 | crates/loro-wasm/src/lib.rs:4241-4254 | crates/loro-wasm/src/lib.rs:4684-4697 | crates/loro-wasm/src/lib.rs:5480-5493 — These 6 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 6 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 6 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/loro-internal/src/handler.rs:520 — crates/loro-internal/src/handler.rs:520-527 | crates/loro-internal/src/handler.rs:749-756 | crates/loro-internal/src/handler.rs:880-887 | crates/loro-internal/src/handler.rs:990-997 | crates/loro-internal/src/handler/tree.rs:303-310 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) crates/loro-internal/src/handler.rs:3578 — crates/loro-internal/src/handler.rs:3578-3611 | crates/loro-internal/src/handler.rs:4314-4347 — both copies are in the same file, so extract the 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 (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) crates/loro/src/event.rs:139 — crates/loro/src/event.rs:139-169 | crates/loro/src/event.rs:192-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) crates/loro-internal/src/value.rs:899 — crates/loro-internal/src/value.rs:899-922 | crates/loro-internal/src/value.rs:931-955 — both copies are in the same file, so extract the 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 (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) crates/loro-internal/src/value.rs:316 — crates/loro-internal/src/value.rs:316-337 | crates/loro-internal/src/value.rs:403-426 — both copies are in the same file, so extract the 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 (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) crates/loro-internal/src/encoding/outdated_encode_reordered.rs:307 — crates/loro-internal/src/encoding/outdated_encode_reordered.rs:307-326 | crates/loro-internal/src/encoding/outdated_encode_reordered.rs:375-395 | crates/loro-internal/src/encoding/outdated_encode_reordered.rs:470-490 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 3) · ×1
  • Duplicated block (15–18 lines × 3) crates/loro-internal/src/history_cache.rs:390 — crates/loro-internal/src/history_cache.rs:390-406 | crates/loro-internal/src/history_cache.rs:448-465 | crates/loro-internal/src/history_cache.rs:528-542 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) crates/loro-internal/src/handler.rs:2913 — crates/loro-internal/src/handler.rs:2913-2930 | crates/loro-internal/src/state/richtext_state.rs:270-284 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) crates/loro-internal/src/state/tree_state.rs:181 — crates/loro-internal/src/state/tree_state.rs:181-196 | crates/loro-internal/src/state/tree_state.rs:1740-1757 — both copies are in the same file, so extract the 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 (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) crates/loro-wasm-tools/src/main.rs:206 — crates/loro-wasm-tools/src/main.rs:206-220 | crates/loro-wasm-tools/src/main.rs:260-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) crates/loro-internal/src/handler.rs:3556 — crates/loro-internal/src/handler.rs:3556-3569 | crates/loro-internal/src/handler.rs:4272-4286 — both copies are in the same file, so extract the 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 (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) crates/loro-internal/src/handler.rs:720 — crates/loro-internal/src/handler.rs:720-733 | crates/loro-internal/src/handler.rs:851-864 | crates/loro-internal/src/handler.rs:961-974 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) crates/loro-internal/src/state/richtext_state.rs:132 — crates/loro-internal/src/state/richtext_state.rs:132-144 | crates/loro-internal/src/state/richtext_state.rs:189-201 | crates/loro-internal/src/state/richtext_state.rs:217-229 | crates/loro-internal/src/state/richtext_state.rs:1518-1530 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) crates/fuzz/src/crdt_fuzzer.rs:976 — crates/fuzz/src/crdt_fuzzer.rs:976-987 | crates/fuzz/src/crdt_fuzzer.rs:1100-1111 | crates/loro-internal/src/fuzz.rs:20-31 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/loro-internal/src/fuzz.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×1
  • Duplicated block (12 lines × 2) crates/loro-internal/src/jsonpath/parser.rs:335 — crates/loro-internal/src/jsonpath/parser.rs:335-346 | crates/loro-internal/src/jsonpath/parser.rs:406-417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) crates/loro-wasm/src/counter.rs:72 — crates/loro-wasm/src/counter.rs:72-82 | crates/loro-wasm/src/lib.rs:3271-3281 | crates/loro-wasm/src/lib.rs:3832-3842 | crates/loro-wasm/src/lib.rs:4242-4252 | crates/loro-wasm/src/lib.rs:5481-5491 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:89 — crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:89-98 | crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:141-151 — both copies are in the same file, so extract the 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 (7–11 lines × 2) · ×1
  • Duplicated block (7–11 lines × 2) crates/loro-internal/src/state.rs:1734 — crates/loro-internal/src/state.rs:1734-1740 | crates/loro-internal/src/state.rs:1821-1831 — both copies are in the same file, so extract the 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 (9–10 lines × 6) · ×1
  • Duplicated block (9–10 lines × 6) crates/loro-wasm/src/counter.rs:76 — crates/loro-wasm/src/counter.rs:76-84 | crates/loro-wasm/src/lib.rs:3275-3284 | crates/loro-wasm/src/lib.rs:3836-3845 | crates/loro-wasm/src/lib.rs:4246-4254 | crates/loro-wasm/src/lib.rs:4689-4697 | crates/loro-wasm/src/lib.rs:5485-5493 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×1
  • Duplicated block (8–9 lines × 4) crates/generic-btree/src/generic_impl/gap_buffer.rs:192 — crates/generic-btree/src/generic_impl/gap_buffer.rs:192-199 | crates/generic-btree/src/lib.rs:2999-3006 | crates/generic-btree/src/rle.rs:12-20 | crates/generic-btree/src/rle.rs:53-61 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) crates/fuzz/src/crdt_fuzzer.rs:1093 — crates/fuzz/src/crdt_fuzzer.rs:1093-1100 | crates/fuzz/src/mem_kv_fuzzer.rs:284-291 | crates/loro-internal/src/fuzz.rs:12-20 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/mem_kv_fuzzer.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×1
  • Duplicated block (9 lines × 3) crates/loro-internal/src/handler.rs:3678 — crates/loro-internal/src/handler.rs:3678-3686 | crates/loro-internal/src/handler.rs:4373-4381 | crates/loro-internal/src/handler.rs:4874-4882 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–9 lines × 3) · ×1
  • Duplicated block (4–9 lines × 3) crates/loro-internal/src/oplog/change_store.rs:314 — crates/loro-internal/src/oplog/change_store.rs:314-317 | crates/loro-internal/src/oplog/change_store.rs:1113-1121 | crates/loro-internal/src/oplog/change_store.rs:1148-1156 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) crates/fuzz/src/crdt_fuzzer.rs:975 — crates/fuzz/src/crdt_fuzzer.rs:975-982 | crates/fuzz/src/crdt_fuzzer.rs:1099-1106 | crates/fuzz/src/crdt_fuzzer.rs:1121-1128 | crates/loro-internal/src/fuzz.rs:19-26 | crates/loro-internal/src/fuzz.rs:48-55 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/loro-internal/src/fuzz.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×1
  • Duplicated block (7 lines × 5) crates/loro-internal/src/handler.rs:521 — crates/loro-internal/src/handler.rs:521-527 | crates/loro-internal/src/handler.rs:750-756 | crates/loro-internal/src/handler.rs:881-887 | crates/loro-internal/src/handler.rs:991-997 | crates/loro-internal/src/handler/tree.rs:304-310 — before extracting anything, compare `crates/loro-internal/src/handler.rs` and `crates/loro-internal/src/handler/tree.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) crates/fuzz/src/crdt_fuzzer.rs:1098 — crates/fuzz/src/crdt_fuzzer.rs:1098-1104 | crates/fuzz/src/mem_kv_fuzzer.rs:289-295 | crates/loro-internal/src/fuzz.rs:18-24 | crates/loro-internal/src/fuzz.rs:47-53 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/mem_kv_fuzzer.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×1
  • Duplicated block (6 lines × 3) crates/loro-wasm-tools/src/main.rs:126 — crates/loro-wasm-tools/src/main.rs:126-131 | crates/loro-wasm-tools/src/main.rs:172-177 | crates/loro-wasm-tools/src/main.rs:240-245 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) crates/loro-internal/src/handler.rs:3372 — crates/loro-internal/src/handler.rs:3372-3377 | crates/loro-internal/src/handler.rs:3949-3954 | crates/loro-internal/src/handler.rs:4046-4049 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) crates/loro-internal/src/awareness.rs:814 — crates/loro-internal/src/awareness.rs:814-818 | crates/loro-internal/src/loro.rs:2654-2658 | crates/loro-internal/src/loro.rs:3606-3613 | crates/loro-internal/src/loro.rs:3619-3623 | crates/loro-internal/src/subscription.rs:25-29 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×1
  • Duplicated block (8 lines × 3) crates/loro-internal/src/encoding/fast_snapshot.rs:65 — crates/loro-internal/src/encoding/fast_snapshot.rs:65-72 | crates/loro-internal/src/encoding/fast_snapshot.rs:74-81 | crates/loro-internal/src/encoding/fast_snapshot.rs:88-95 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Near-duplicate member pair (104 shared lines) · ×1
  • Near-duplicate member pair (104 shared lines) crates/fuzz/src/crdt_fuzzer.rs:143 — crates/fuzz/src/crdt_fuzzer.rs:143-465 | crates/fuzz/src/one_doc_fuzzer.rs:436-902 — These two members are variants of one another: 104 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 · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:288 — crates/fuzz/src/crdt_fuzzer.rs:288-320 | crates/fuzz/src/one_doc_fuzzer.rs:719-751 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25–29 lines × 2) · ×1
  • Duplicated block (25–29 lines × 2) crates/fuzz/src/container/counter.rs:98 — crates/fuzz/src/container/counter.rs:98-126 | crates/fuzz/src/container/counter.rs:128-152 — both copies are in the same file, so extract the 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 (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) crates/fuzz/src/crdt_fuzzer.rs:323 — crates/fuzz/src/crdt_fuzzer.rs:323-340 | crates/fuzz/src/crdt_fuzzer.rs:386-403 | crates/fuzz/src/one_doc_fuzzer.rs:754-771 | crates/fuzz/src/one_doc_fuzzer.rs:817-834 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×1
  • Duplicated block (17 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:360 — crates/fuzz/src/crdt_fuzzer.rs:360-376 | crates/fuzz/src/one_doc_fuzzer.rs:791-807 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) crates/fuzz/src/container/tree.rs:232 — crates/fuzz/src/container/tree.rs:232-243 | crates/fuzz/src/one_doc_fuzzer.rs:325-337 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) crates/fuzz/src/container/tree.rs:263 — crates/fuzz/src/container/tree.rs:263-271 | crates/fuzz/src/one_doc_fuzzer.rs:361-371 — before extracting anything, compare `crates/fuzz/src/container/tree.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) crates/fuzz/src/one_doc_fuzzer.rs:217 — crates/fuzz/src/one_doc_fuzzer.rs:217-226 | crates/fuzz/src/one_doc_fuzzer.rs:239-248 | crates/fuzz/src/one_doc_fuzzer.rs:256-265 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×1
  • Duplicated block (7 lines × 3) crates/fuzz/src/crdt_fuzzer.rs:682 — crates/fuzz/src/crdt_fuzzer.rs:682-688 | crates/fuzz/src/crdt_fuzzer.rs:717-723 | crates/fuzz/src/one_doc_fuzzer.rs:943-949 — before extracting anything, compare `crates/fuzz/src/crdt_fuzzer.rs` and `crates/fuzz/src/one_doc_fuzzer.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 182 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) crates/fuzz/src/container/counter.rs:155 — crates/fuzz/src/container/counter.rs:155-162 | crates/fuzz/src/container/list.rs:84-91 | crates/fuzz/src/container/map.rs:64-71 | crates/fuzz/src/container/movable_list.rs:94-101 | crates/fuzz/src/container/text.rs:89-96 | crates/fuzz/src/container/tree.rs:169-176 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once.
D5 · Coupling · Unstable project loro (Cargo) · ×1
  • Unstable project loro (Cargo) — loro (Cargo) has instability 0.83 with 1 dependents.
D8 · Code Coverage · Coverage not measured · ×1
  • Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — crates/loro-wasm/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
R10 · Code Duplication · Duplicated block (55 lines × 2 locations) · ×1
  • Duplicated block (55 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:3658 — loro-js/src/runtime/sequence-index.ts:3658 · loro-js/src/runtime/sequence-index.ts:3714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (44 lines × 2 locations) · ×1
  • Duplicated block (44 lines × 2 locations) packages/fractional-index/src/index.ts:135 — packages/fractional-index/src/index.ts:135 · packages/fractional-index/src/index.ts:237 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (40 lines × 2 locations) · ×1
  • Duplicated block (40 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:2866 — loro-js/src/runtime/sequence-index.ts:2866 · loro-js/src/runtime/sequence-index.ts:2981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block with local edits (39 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (39 matched lines × 2 locations) loro-js/src/codec/change-value.ts:347 — loro-js/src/codec/change-value.ts:347 · loro-js/src/codec/value.ts:31 — the two spans are one implementation copied and then locally edited — 220 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (36 lines × 2 locations) · ×1
  • Duplicated block (36 lines × 2 locations) loro-js/src/codec/container-id.ts:23 — loro-js/src/codec/container-id.ts:23 · loro-js/src/codec/container-id.ts:62 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (33 lines × 2 locations) · ×1
  • Duplicated block (33 lines × 2 locations) loro-js/src/codec/serde-columnar.ts:398 — loro-js/src/codec/serde-columnar.ts:398 · loro-js/src/codec/serde-columnar.ts:452 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (29 lines × 2 locations) · ×1
  • Duplicated block (29 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:1075 — loro-js/src/runtime/sequence-index.ts:1075 · loro-js/src/runtime/sequence-index.ts:1163 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (27 lines × 2 locations) · ×1
  • Duplicated block (27 lines × 2 locations) loro-js/src/runtime/sequence-deletion-index.ts:238 — loro-js/src/runtime/sequence-deletion-index.ts:238 · loro-js/src/runtime/sequence-index.ts:3321 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Duplicated block with local edits (26 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (26 matched lines × 2 locations) loro-js/src/runtime/sequence-deletion-index.ts:169 — loro-js/src/runtime/sequence-deletion-index.ts:169 · loro-js/src/runtime/text-style-index.ts:332 — the two spans are one implementation copied and then locally edited — 236 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (24 lines × 3 locations) · ×1
  • Duplicated block (24 lines × 3 locations) loro-js/src/runtime/sequence-index.ts:2281 — loro-js/src/runtime/sequence-index.ts:2281 · loro-js/src/runtime/sequence-index.ts:2921 · loro-js/src/runtime/sequence-index.ts:3036 — 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.
R10 · Code Duplication · Duplicated block (21 lines × 2 locations) · ×1
  • Duplicated block (21 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:2128 — loro-js/src/runtime/sequence-index.ts:2128 · loro-js/src/runtime/sequence-index.ts:2202 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (20 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (20 matched lines × 2 locations) loro-js/src/codec/value.ts:26 — loro-js/src/codec/value.ts:26 · loro-js/src/codec/value.ts:131 — the two spans are one implementation copied and then locally edited — 144 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (19 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (19 matched lines × 2 locations) loro-js/src/runtime/ordered-index.ts:241 — loro-js/src/runtime/ordered-index.ts:241 · loro-js/src/runtime/sequence-index.ts:2020 — the two spans are one implementation copied and then locally edited — 120 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:2084 — loro-js/src/runtime/sequence-index.ts:2084 · loro-js/src/runtime/sequence-index.ts:2145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (18 lines × 2 locations) · ×1
  • Duplicated block (18 lines × 2 locations) loro-js/src/runtime/sequence-index.ts:4023 — loro-js/src/runtime/sequence-index.ts:4023 · loro-js/src/runtime/sequence-index.ts:4042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (17 lines × 3 locations) · ×1
  • Duplicated block (17 lines × 3 locations) loro-js/src/codec/container-id.ts:37 — loro-js/src/codec/container-id.ts:37 · loro-js/src/codec/container-id.ts:76 · loro-js/src/runtime/ids.ts:77 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (13 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (13 matched lines × 2 locations) loro-js/src/codec/leb128.ts:49 — loro-js/src/codec/leb128.ts:49 · loro-js/src/codec/serde-columnar.ts:584 — the two spans are one implementation copied and then locally edited — 65 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 3 locations) · ×1
  • Duplicated block (13 lines × 3 locations) REDACTED:8238 — REDACTED:8238 · REDACTED:8265 · loro-js/src/runtime/movable-list.ts:724 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 42, cognitive 87) · ×1
  • Complex function (anonymous) (cyclomatic 42, cognitive 87) REDACTED:5891 — (anonymous) has cyclomatic complexity 42 and cognitive complexity 87; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function concreteOp (cyclomatic 40, cognitive 56) · ×1
  • Complex function concreteOp (cyclomatic 40, cognitive 56) loro-js/tests/fuzz/differential.ts:991 — concreteOp has cyclomatic complexity 40 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function jsonOperationToDecoded (cyclomatic 37, cognitive 64) · ×1
  • Complex function jsonOperationToDecoded (cyclomatic 37, cognitive 64) REDACTED:10197 — jsonOperationToDecoded has cyclomatic complexity 37 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function transition (cyclomatic 34, cognitive 45) · ×1
  • Complex function transition (cyclomatic 34, cognitive 45) loro-js/src/runtime/movable-list.ts:540 — transition has cyclomatic complexity 34 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function generateAction (cyclomatic 32, cognitive 26) · ×1
  • Complex function generateAction (cyclomatic 32, cognitive 26) loro-js/tests/differential/fuzz.ts:245 — generateAction has cyclomatic complexity 32 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function recomputeOwnElements (cyclomatic 31, cognitive 52) · ×1
  • Complex function recomputeOwnElements (cyclomatic 31, cognitive 52) loro-js/src/runtime/sequence-index.ts:2947 — recomputeOwnElements has cyclomatic complexity 31 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function decodeImportBlobMeta (cyclomatic 31, cognitive 46) · ×1
  • Complex function decodeImportBlobMeta (cyclomatic 31, cognitive 46) REDACTED:8895 — decodeImportBlobMeta has cyclomatic complexity 31 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function applySelector (cyclomatic 30, cognitive 77) · ×1
  • Complex function applySelector (cyclomatic 30, cognitive 77) loro-js/src/runtime/jsonpath.ts:281 — applySelector has cyclomatic complexity 30 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertSpanAtPhysical (cyclomatic 29, cognitive 46) · ×1
  • Complex function insertSpanAtPhysical (cyclomatic 29, cognitive 46) loro-js/src/runtime/sequence-index.ts:1104 — insertSpanAtPhysical has cyclomatic complexity 29 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function apply (cyclomatic 29, cognitive 21) · ×1
  • Complex function apply (cyclomatic 29, cognitive 21) loro-js/tests/differential/fuzz.ts:405 — apply has cyclomatic complexity 29 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function recomputeOwn (cyclomatic 28, cognitive 47) · ×1
  • Complex function recomputeOwn (cyclomatic 28, cognitive 47) loro-js/src/runtime/sequence-index.ts:2834 — recomputeOwn has cyclomatic complexity 28 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function generateActions (cyclomatic 28, cognitive 35) · ×1
  • Complex function generateActions (cyclomatic 28, cognitive 35) loro-js/tests/support/richtext-differential.ts:189 — generateActions has cyclomatic complexity 28 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function encodeChangeValueContent (cyclomatic 28, cognitive 17) · ×1
  • Complex function encodeChangeValueContent (cyclomatic 28, cognitive 17) loro-js/src/codec/change-value.ts:212 — encodeChangeValueContent has cyclomatic complexity 28 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function apply (cyclomatic 27, cognitive 47) · ×1
  • Complex function apply (cyclomatic 27, cognitive 47) loro-js/src/runtime/movable-list-undo.ts:73 — apply has cyclomatic complexity 27 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function primitiveCompare (cyclomatic 27, cognitive 29) · ×1
  • Complex function primitiveCompare (cyclomatic 27, cognitive 29) loro-js/src/runtime/jsonpath.ts:766 — primitiveCompare has cyclomatic complexity 27 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertAtPhysical (cyclomatic 26, cognitive 40) · ×1
  • Complex function insertAtPhysical (cyclomatic 26, cognitive 40) loro-js/src/runtime/sequence-index.ts:1025 — insertAtPhysical has cyclomatic complexity 26 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function decodeOperationContent (cyclomatic 25, cognitive 40) · ×1
  • Complex function decodeOperationContent (cyclomatic 25, cognitive 40) loro-js/src/codec/change-block-codec.ts:358 — decodeOperationContent has cyclomatic complexity 25 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function #record (cyclomatic 25, cognitive 27) · ×1
  • Complex function #record (cyclomatic 25, cognitive 27) loro-js/src/runtime/undo.ts:239 — #record has cyclomatic complexity 25 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function #apply (cyclomatic 25, cognitive 24) · ×1
  • Complex function #apply (cyclomatic 25, cognitive 24) loro-js/tests/support/richtext-differential.ts:349 — #apply has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function equivalentEvents (cyclomatic 24, cognitive 43) · ×1
  • Complex function equivalentEvents (cyclomatic 24, cognitive 43) loro-js/tests/differential/harness.ts:484 — equivalentEvents has cyclomatic complexity 24 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 11099 lines of code REDACTED:1 — REDACTED has 11099 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/sequence-index.ts · ×1
  • loro-js/src/runtime/sequence-index.ts: 4095 lines of code loro-js/src/runtime/sequence-index.ts:1 — loro-js/src/runtime/sequence-index.ts has 4095 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/containers.ts · ×1
  • loro-js/src/runtime/containers.ts: 3721 lines of code loro-js/src/runtime/containers.ts:1 — loro-js/src/runtime/containers.ts has 3721 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/movable-list.ts · ×1
  • loro-js/src/runtime/movable-list.ts: 997 lines of code loro-js/src/runtime/movable-list.ts:1 — loro-js/src/runtime/movable-list.ts has 997 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/state-snapshot.ts · ×1
  • loro-js/src/codec/state-snapshot.ts: 979 lines of code loro-js/src/codec/state-snapshot.ts:1 — loro-js/src/codec/state-snapshot.ts has 979 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/jsonpath.ts · ×1
  • loro-js/src/runtime/jsonpath.ts: 859 lines of code loro-js/src/runtime/jsonpath.ts:1 — loro-js/src/runtime/jsonpath.ts has 859 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/change-block-codec.ts · ×1
  • loro-js/src/codec/change-block-codec.ts: 797 lines of code loro-js/src/codec/change-block-codec.ts:1 — loro-js/src/codec/change-block-codec.ts has 797 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/serde-columnar.ts · ×1
  • loro-js/src/codec/serde-columnar.ts: 700 lines of code loro-js/src/codec/serde-columnar.ts:1 — loro-js/src/codec/serde-columnar.ts has 700 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/sstable.ts · ×1
  • loro-js/src/codec/sstable.ts: 553 lines of code loro-js/src/codec/sstable.ts:1 — loro-js/src/codec/sstable.ts has 553 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/ephemeral.ts · ×1
  • loro-js/src/runtime/ephemeral.ts: 529 lines of code loro-js/src/runtime/ephemeral.ts:1 — loro-js/src/runtime/ephemeral.ts has 529 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/fractional-index/src/index.ts · ×1
  • packages/fractional-index/src/index.ts: 498 lines of code packages/fractional-index/src/index.ts:1 — packages/fractional-index/src/index.ts has 498 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/change-value.ts · ×1
  • loro-js/src/codec/change-value.ts: 469 lines of code loro-js/src/codec/change-value.ts:1 — loro-js/src/codec/change-value.ts has 469 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/runtime/text-style-index.ts · ×1
  • loro-js/src/runtime/text-style-index.ts: 467 lines of code loro-js/src/runtime/text-style-index.ts:1 — loro-js/src/runtime/text-style-index.ts has 467 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · crates/loro-wasm/index.ts · ×1
  • crates/loro-wasm/index.ts: 461 lines of code crates/loro-wasm/index.ts:1 — crates/loro-wasm/index.ts has 461 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · loro-js/src/codec/change-block-tables.ts · ×1
  • loro-js/src/codec/change-block-tables.ts: 447 lines of code loro-js/src/codec/change-block-tables.ts:1 — loro-js/src/codec/change-block-tables.ts has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · crates/loro-wasm/scripts/build.ts · ×1
  • crates/loro-wasm/scripts/build.ts: 434 lines of code crates/loro-wasm/scripts/build.ts:1 — crates/loro-wasm/scripts/build.ts has 434 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~116 LoC) · ×1
  • Dead file (~116 LoC) scripts/run-js-doc-tests.ts — no import path from any entry point (25 application, 10 tooling, 109 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~81 LoC) · ×1
  • Dead file (~81 LoC) REDACTED — no import path from any entry point (25 application, 10 tooling, 109 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~49 LoC) · ×1
  • Dead file (~49 LoC) crates/loro-internal/scripts/mem.ts — no import path from any entry point (25 application, 10 tooling, 109 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (crates/loro-internal/scripts/run_mem.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
R7 · Dead Code · Dead file (~36 LoC) · ×1
  • Dead file (~36 LoC) crates/loro-internal/scripts/fuzz.ts — no import path from any entry point (25 application, 10 tooling, 109 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~9 LoC) · ×1
  • Dead file (~9 LoC) crates/loro-internal/scripts/run_mem.ts — no import path from any entry point (25 application, 10 tooling, 109 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
S1 · Web-Security Posture · Weak hash algorithm · ×1
  • Weak hash algorithm crates/loro-internal/src/encoding.rs:315 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×1
  • Swallowed exception (caught, then discarded) crates/loro-wasm/scripts/build.ts:400 — `catch (_err)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Minor — 59 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×20
  • Duplicated predicate loro-js/src/runtime/ids.ts:162 — `!Number.isSafeInteger(counter) || counter < 0 || counter > 0x7fff_ffff` appears character-identically in 2 files — loro-js/src/runtime/ids.ts, loro-js/src/runtime/version-vector.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:4018 — `!Number.isSafeInteger(index) || index < 0 || index >= length` appears character-identically in 2 files — loro-js/src/runtime/containers.ts, loro-js/src/runtime/sequence-index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/codec/bytes.ts:104 — `!Number.isSafeInteger(length) || length < 0` appears character-identically in 2 files — loro-js/src/codec/bytes.ts, loro-js/src/codec/lz4.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:567 — `!Number.isSafeInteger(position) || position < 0 || position > this.length` appears character-identically in 2 files — loro-js/src/runtime/containers.ts, loro-js/src/runtime/event-diff.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/codec/change-block-codec.ts:784 — `!Number.isSafeInteger(value) || value < -0x8000_0000 || value > 0x7fff_ffff` appears character-identically in 4 files — loro-js/src/codec/change-block-codec.ts, loro-js/src/codec/change-value.ts, loro-js/src/codec/postcard.ts, loro-js/src/codec/serde-columnar.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/codec/change-block-codec.ts:763 — `!Number.isSafeInteger(value) || value < 0 || value > 0x7fff_ffff` appears character-identically in 2 files — loro-js/src/codec/change-block-codec.ts, loro-js/src/codec/change-value.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/codec/bytes.ts:206 — `!Number.isSafeInteger(value) || value < 0 || value > max` appears character-identically in 2 files — loro-js/src/codec/bytes.ts, loro-js/src/codec/postcard.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:2500 — `Array.isArray(left) && Array.isArray(right)` appears character-identically in 2 files — loro-js/src/runtime/containers.ts, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:10249 — `content.type === "insert" && typeof content.text === "string"` appears character-identically in 2 files — REDACTED, loro-js/src/runtime/json-updates.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:2412 — `left === undefined || right === undefined` appears character-identically in 4 files — loro-js/src/runtime/containers.ts, REDACTED, loro-js/src/runtime/event-diff.ts, loro-js/src/runtime/sequence-index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:2495 — `left instanceof Uint8Array && right instanceof Uint8Array` appears character-identically in 2 files — loro-js/src/runtime/containers.ts, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:11315 — `left instanceof Uint8Array || right instanceof Uint8Array` appears character-identically in 2 files — REDACTED, loro-js/src/runtime/movable-list.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/codec/change-block-codec.ts:791 — `left.peer === right.peer && left.counter === right.counter` appears character-identically in 3 files — loro-js/src/codec/change-block-codec.ts, loro-js/src/runtime/containers.ts, loro-js/src/runtime/ids.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/loro-wasm/scripts/build.ts:342 — `name != null && /^[A-Za-z_$][\w$]*$/.test(name)` appears character-identically in 2 files — crates/loro-wasm/scripts/build.ts, crates/loro-wasm/scripts/post-rollup.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/sequence-deletion-index.ts:250 — `previous !== undefined && previous.start.peer === run.start.peer && run.start.counter <= previous.start.counter + previous.length` appears character-identically in 3 files — loro-js/src/runtime/sequence-deletion-index.ts, loro-js/src/runtime/sequence-index.ts, loro-js/src/runtime/text-style-index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:7351 — `previous !== undefined && range.start <= previous.end` appears character-identically in 2 files — REDACTED, loro-js/src/runtime/sequence-index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/sequence-deletion-index.ts:203 — `previous === undefined || counter >= previous.end` appears character-identically in 2 files — loro-js/src/runtime/sequence-deletion-index.ts, loro-js/src/runtime/text-style-index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:10947 — `typeof left === "object" && left !== null && typeof right === "object" && right !== null` appears character-identically in 2 files — REDACTED, loro-js/src/runtime/movable-list.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:11273 — `typeof value !== "number" || !Number.isSafeInteger(value) || value < 0` appears character-identically in 2 files — REDACTED, packages/fractional-index/src/index.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate loro-js/src/runtime/containers.ts:3429 — `typeof value === "object" && value !== null` appears character-identically in 4 files — loro-js/src/runtime/containers.ts, REDACTED, loro-js/src/runtime/json-updates.ts, loro-js/src/runtime/jsonpath.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X4 · Structured logging · Interpolated log message defeats structured logging · ×18
  • Interpolated log message defeats structured logging crates/loro-internal/src/arena.rs:476 — `info!` at line 476 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/arena.rs:489 — `info!` at line 489 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/arena.rs:496 — `info!` at line 496 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/handler.rs:2364 — `error!` at line 2364 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/loro.rs:3314 — `error!` at line 3314 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/loro.rs:4104 — `warn!` at line 4104 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/state.rs:758 — `warn!` at line 758 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/state/movable_list_state.rs:369 — `error!` at line 369 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/state/movable_list_state.rs:374 — `error!` at line 374 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:125 — `info!` at line 125 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:126 — `info!` at line 126 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:127 — `info!` at line 127 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:128 — `info!` at line 128 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:129 — `info!` at line 129 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:130 — `info!` at line 130 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:131 — `info!` at line 131 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro-internal/src/oplog/change_store/block_encode.rs:132 — `info!` at line 132 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging crates/loro/src/lib.rs:3708 — `info!` at line 3708 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
D34 · Knowledge Freshness · Orphaned file · ×4
  • Orphaned file crates/loro-internal/src/jsonpath/ast.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/loro-internal/src/allocation/dfs.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/loro-internal/src/allocation/bfs.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file crates/loro-internal/src/state/mergeable.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
AX6 · Interface segregation · Fat interface · ×2
  • Fat interface: DocLike (26 required operations) loro-js/tests/differential/engine.ts:70 — `DocLike` declares 26 required operations: `setPeerId`, `getMovableList`, `getMap`, `getContainerById`, `commit`, `getPendingTxnLength`, `export`, `import`, `importBatch`, `toJSON`, `getShallowValue`, `oplogVersion`, `frontiers`, `oplogFrontiers`, `checkout`, `checkoutToLatest`, `isDetached`, `revertTo`, `diff`, `subscribe`, `isShallow`, `shallowSinceVV`, `getCursorPos`, `getPathToContainer`, `forkAt`, `fork`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: FractionalIndexNamespace (16 required operations) packages/fractional-index/src/index.ts:20 — `FractionalIndexNamespace` declares 16 required operations: `default`, `fromHexString`, `new`, `newBefore`, `newAfter`, `newBetween`, `generateNEvenly`, `jitterDefault`, `newJitter`, `newBeforeJitter`, `newAfterJitter`, `newBetweenJitter`, `generateNEvenlyJitter`, `compare`, `equals`, `isFractionalIndex`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
M4 · Documentation accuracy · README/code drift · ×2
  • README/code drift crates/loro/README.md:60 — crates/loro/README.md links to `struct.LoroDoc.html`, but `crates/loro/struct.LoroDoc.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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 crates/loro/README.md:80 — crates/loro/README.md links to `trait.ToJson.html`, but `crates/loro/trait.ToJson.html` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, 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 — 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/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 2 of 17 project(s) overshoot their size bounds, lowering Project Cohesion to 7.6/10. The most over is `crates/loro-internal` (79971 LoC, 283 module-visible types across 23 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 4 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: crates/loro-internal/src/jsonpath/ast.rs, crates/loro-internal/src/allocation/dfs.rs, crates/loro-internal/src/allocation/bfs.rs, crates/loro-internal/src/state/mergeable.rs (5 orphaned of 196 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 196 of the 265 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
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 9/11 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `crates/loro-wasm-tools`.
R7 · Dead Code · Unused module-local declaration 'decorateAllPrototypeMethods' · ×1
  • Unused module-local declaration 'decorateAllPrototypeMethods' crates/loro-wasm/index.ts:467 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'showFrontiers' · ×1
  • Unused module-local declaration 'showFrontiers' crates/loro-wasm/tests/issue.test.ts:90 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~16.0 `!` null assertions per 1k TypeScript source lines — 549 assertion(s) across the 34404 source line(s) of the 51 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: REDACTED (168), loro-js/src/runtime/sequence-index.ts (81), loro-js/src/runtime/containers.ts (63). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Minor — 33 finding(s)
D12 · Dependency Hygiene · Outdated · ×22
  • Outdated: anyhow — `anyhow` is locked at 1.0.99 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1.0.89"` requirement declared in crates/loro-wasm-tools/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arbitrary — `arbitrary` is locked at 1.4.2 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1.2.0"` requirement declared in crates/bench-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arbitrary` and commit the updated REDACTED.
  • Outdated: arrayvec — `arrayvec` is locked at 0.7.6 but 0.7.8 is the current stable release on crates.io, and it already satisfies the `"0.7.4"` requirement declared in crates/delta/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arrayvec` and commit the updated REDACTED.
  • Outdated: bytes — `bytes` is locked at 1.10.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytes` and commit the updated REDACTED.
  • Outdated: chrono — `chrono` is locked at 0.4.41 but 0.4.45 is the current stable release on crates.io, and it already satisfies the `"0.4.35"` requirement declared in crates/dev-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p chrono` and commit the updated REDACTED.
  • Outdated: clap — `clap` is locked at 4.5.47 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5.4"` requirement declared in crates/loro-wasm-tools/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: either — `either` is locked at 1.15.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
  • Outdated: flate2 — `flate2` is locked at 1.1.2 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1.0.25"` requirement declared in crates/bench-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
  • Outdated: js-sys — `js-sys` is locked at 0.3.77 but 0.3.106 is the current stable release on crates.io, and it already satisfies the `"0.3.60"` requirement declared in crates/loro-common/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p js-sys` and commit the updated REDACTED.
  • Outdated: leb128 — `leb128` is locked at 0.2.5 but 0.2.7 is the current stable release on crates.io, and it already satisfies the `"0.2.5"` requirement declared in crates/loro-common/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p leb128` and commit the updated REDACTED.
  • Outdated: once_cell — `once_cell` is locked at 1.21.3 but 1.21.4 is the current stable release on crates.io, and it already satisfies the `"1.18.0"` requirement declared in crates/fractional_index/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p once_cell` and commit the updated REDACTED.
  • Outdated: pest — `pest` is locked at 2.8.3 but 2.9.5 is the current stable release on crates.io, and it already satisfies the `"2.8.3"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pest` and commit the updated REDACTED.
  • Outdated: pest_derive — `pest_derive` is locked at 2.8.3 but 2.9.5 is the current stable release on crates.io, and it already satisfies the `"2.8.3"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pest_derive` and commit the updated REDACTED.
  • Outdated: proc-macro2 — `proc-macro2` is locked at 1.0.101 but 1.0.107 is the current stable release on crates.io, and it already satisfies the `"1.0.67"` requirement declared in crates/generic-btree/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p proc-macro2` and commit the updated REDACTED.
  • Outdated: rayon — `rayon` is locked at 1.11.0 but 1.12.0 is the current stable release on crates.io, and it already satisfies the `"1.10.0"` requirement declared in crates/fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rayon` and commit the updated REDACTED.
  • Outdated: rustc-hash — `rustc-hash` is locked at 2.1.1 but 2.1.3 is the current stable release on crates.io, and it already satisfies the `"2.1.1"` requirement declared in crates/fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustc-hash` and commit the updated REDACTED.
  • Outdated: serde_json — `serde_json` is locked at 1.0.143 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in crates/bench-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
  • Outdated: smallvec — `smallvec` is locked at 1.15.1 but 1.16.4 is the current stable release on crates.io, and it already satisfies the `"1.8.0"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p smallvec` and commit the updated REDACTED.
  • Outdated: thread_local — `thread_local` is locked at 1.1.9 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1.1.8"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p thread_local` and commit the updated REDACTED.
  • Outdated: tracing — `tracing` is locked at 0.1.41 but 0.1.44 is the current stable release on crates.io, and it already satisfies the `"0.1.40"` requirement declared in crates/dev-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tracing` and commit the updated REDACTED.
  • Outdated: tracing-subscriber — `tracing-subscriber` is locked at 0.3.20 but 0.3.23 is the current stable release on crates.io, and it already satisfies the `"0.3.18"` requirement declared in crates/dev-utils/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tracing-subscriber` and commit the updated REDACTED.
  • Outdated: xxhash-rust — `xxhash-rust` is locked at 0.8.15 but 0.8.19 is the current stable release on crates.io, and it already satisfies the `"0.8.12"` requirement declared in crates/kv-store/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p xxhash-rust` and commit the updated REDACTED.
D10 · Test Quality · Skipped (documented) · ×11
  • Skipped (documented): (unnamed test) loro-js/tests/legacy-data.test.ts:104 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/pending-updates.test.ts:298 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/pending-updates.test.ts:341 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/pending-updates.test.ts:440 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/tree-concurrent-moves.test.ts:230 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/tree-concurrent-moves.test.ts:298 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/tree-concurrent-moves.test.ts:342 — Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
  • Skipped (documented): (unnamed test) loro-js/tests/differential/movable-list.test.ts:144 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): handles quoted keys with special characters crates/loro-wasm/tests/jsonpath.test.ts:355 — Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
  • Skipped (documented): should support get cursor crates/loro-wasm/tests/movable_list.test.ts:69 — Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
  • Skipped (documented): reports the failing allocation size before trapping crates/loro-wasm/tests/oom.test.ts:10 — Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-cc43c92d19c9476c8e8843813d693ca1/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-cc43c92d19c9476c8e8843813d693ca1/tree.json --exit-code 0 --source .2artifacts/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/watchdog-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 .45artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update92artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .12artifacts/raw/trivy-config.json
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 4 file(s) — `crates/loro-wasm/index.ts`, `loro-js/src/runtime/containers.ts`, `REDACTED`, `loro-js/src/runtime/jsonpath.ts` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17ecd-0af8-7d6e-8b83-d868c1f3f5bc · 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