Public report of loro-dev/loro, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 18:12 UTC · Survey ID cd_dac2daaadbaf40b182089c1e9296d293
loro-dev/loro
Measured 14 November 2026, 18:11 UTC, at code version 9846547
Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureNoCollector).
Test reliability is not measured: The rust executor ran against the .rs half and did not finish re-running within its tier budget.
CAI scoreAt riskUp 2 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 156,417 lines of product code in 20 projects, tests not counted · Estimated rebuild effort: about 2.0 person-years · Weakest lens: Code Health, 46
Findings by how serious they are
97 critical1270 serious108 minor
13 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 18:11 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
60of 60 dimensions measured by tools.
1432of 1475 findings point to an exact file and line, so you can open each one in the code. The other 43 concern the repository as a whole, such as missing documentation.
60dimensions across 6 lenses, read from 156,417 lines of product code in 20 projects.
loro-dev/loro is rated At risk because critical security findings are open. It scores 59 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. Recording design decisions comes next, worth about 2 points. Raising Code Health to 70 would lift the score to about 69.
Forty-five 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 156,417 lines, about €290,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 46 to 70, the lowest score rated Strong, the score would rise from 59 to about 69.
Code composition: what the lines of code are
Product code 56%Tests 44%
New since the last survey: 273 findings
These 273 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FileTooLong: oplog/known_history.rs crates/loro-internal/src/oplog/known_history.rs
God Classes · MethodTooLong: OpLog.try_iter_from_replay_base_causally_filtered crates/loro-internal/src/oplog.rs
God Classes · FunctionTooLong: loro_internal::dag::_walk_to_meet crates/loro-internal/src/dag.rs
God Classes · TooManyMethods: MapHandler crates/loro-internal/src/handler.rs
God Classes · TooManyMethods: UndoManager crates/loro-internal/src/undo.rs
God Classes · ClassTooLong: InnerStore crates/loro-internal/src/state/container_store/inner_store.rs
Code Duplication · Near-duplicate member pair (34 shared lines) crates/loro-internal/src/jsonpath/parser.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 (4 members, 50+ identical tokens) crates/loro-internal/src/encoding/shallow_snapshot.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/loro-internal/src/state/richtext_state.rs
Code Duplication · Edited copy of a member (79 corresponding lines) crates/loro-internal/src/container/richtext/tracker.rs
Code Duplication · Edited copy of a member (59 corresponding lines) crates/loro-internal/src/state/tree_state.rs
Code Duplication · Edited copy of a member (50 corresponding lines) crates/loro/src/event.rs
Code Duplication · Edited copy of a member (39 corresponding lines) crates/kv-store/src/mem_store.rs
Code Duplication · Edited copies of one member (3 members, 35+ corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (41 corresponding lines) crates/generic-btree/src/lib.rs
Code Duplication · Edited copy of a member (31 corresponding lines) crates/generic-btree/src/lib.rs
Code Duplication · Edited copy of a member (26 corresponding lines) crates/loro-common/src/value.rs
Code Duplication · Edited copy of a member (34 corresponding lines) crates/loro-internal/src/value.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs
Code Duplication · Edited copies of one member (3 members, 41+ corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (37 corresponding lines) crates/kv-store/src/iter.rs
Code Duplication · Edited copy of a member (31 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (26 corresponding lines) crates/delta/src/delta_rope/rle_tree.rs
Code Duplication · Edited copy of a member (33 corresponding lines) crates/kv-store/src/block.rs
Code Duplication · Edited copy of a member (19 corresponding lines) crates/loro-internal/src/event.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/loro-wasm/src/lib.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/loro-wasm/src/lib.rs
Code Duplication · Edited copy of a member (23 corresponding lines) crates/kv-store/src/block.rs
Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/rle/src/rle_vec.rs
Code Duplication · Edited copy of a member (19 corresponding lines) crates/loro-internal/src/state/container_store/inner_store.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/loro-internal/src/handler/text_update.rs
Code Duplication · Edited copy of a member (26 corresponding lines) crates/loro-internal/src/encoding/json_schema.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/loro-internal/src/state/map_state.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/loro-internal/src/container/richtext/style_range_map.rs
Code Duplication · Edited copy of a member (12 corresponding lines) crates/loro/src/lib.rs
Code Duplication · Edited copy of a member (21 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (20 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (30 corresponding lines) crates/loro-internal/src/state/list_state.rs
Code Duplication · Edited copy of a member (27 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (25 corresponding lines) crates/generic-btree/src/lib.rs
Code Duplication · Edited copy of a member (19 corresponding lines) crates/generic-btree/src/generic_impl/ord.rs
Code Duplication · Edited copy of a member (29 corresponding lines) crates/kv-store/src/block.rs
Code Duplication · Edited copy of a member (18 corresponding lines) crates/loro-internal/src/handler/tree.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs
Code Duplication · Edited copy of a member (23 corresponding lines) crates/bench-utils/src/lib.rs
Code Duplication · Edited copy of a member (34 corresponding lines) crates/loro-internal/src/delta/seq.rs
Code Duplication · Edited copy of a member (21 corresponding lines) crates/loro-internal/src/utils/string_slice.rs
Code Duplication · Edited copy of a member (17 corresponding lines) crates/loro-internal/src/undo.rs
Code Duplication · Edited copy of a member (19 corresponding lines) crates/loro-internal/src/jsonpath/parser.rs
Code Duplication · Edited copy of a member (18 corresponding lines) crates/loro-internal/src/version.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/loro-internal/src/op.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/loro-internal/src/state/map_state.rs
Code Duplication · Edited copy of a member (12 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (15 corresponding lines) crates/loro-internal/src/loro.rs
Code Duplication · Edited copy of a member (19 corresponding lines) crates/loro-internal/src/container/list/list_op.rs
Code Duplication · Edited copy of a member (21 corresponding lines) crates/loro-internal/src/version/frontiers.rs
Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) crates/loro/src/lib.rs
Code Duplication · Edited copy of a member (9 corresponding lines) crates/dev-utils/src/lib.rs
Code Duplication · Edited copy of a member (16 corresponding lines) crates/loro-internal/src/handler/tree.rs
Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs
Code Duplication · Edited copy of a member (10 corresponding lines) crates/loro-common/src/span.rs
Code Duplication · Edited copy of a member (22 corresponding lines) crates/loro-internal/src/container/richtext/richtext_state.rs
Code Duplication · Edited copy of a member (23 corresponding lines) crates/loro-internal/src/diff_calc/tree.rs
Code Duplication · Edited copy of a member (9 corresponding lines) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs
Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) crates/loro-internal/src/utils/query_by_len.rs
Code Duplication · Edited copy of a member (13 corresponding lines) crates/loro-internal/src/handler.rs
Code Duplication · Edited copy of a member (13 corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/loro-internal/src/state/container_store/inner_store.rs
Code Duplication · Edited copies of one member (5 members, 12+ corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs
Code Duplication · Edited copy of a member (24 corresponding lines) crates/delta/src/utf16.rs
Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) crates/loro-internal/src/awareness.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/loro-internal/src/handler.rs
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 177 findings
These 177 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one. The first 100 are listed here.
€97,000 to €490,000, for 1,624 to 5,154 hours of work, about 2.0 person-years for 1 to 4 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 59. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 156,417 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 7 points · Medium effort · Large Files
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Raises the score by about 2 points · Low effort · ADR Quality
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 €290,000 to build again, about 2.0 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 6.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 105,662 lines over the last 90 days, which is about 428,518 lines a year. At that pace, the extra work comes to an estimated 30.7 to 184.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
223 modules, with 826 dependencies between them. 6 loops run through 78 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 183 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.
loro-js.src.runtime.document uses loro-js.src.runtime.containers, so a change to loro-js.src.runtime.containers can break loro-js.src.runtime.document, while a change to loro-js.src.runtime.document can't break loro-js.src.runtime.containers.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
7→10 loro_common.span uses loro_commonpart of a loop✕
Connections
4 pairs of types, where a type in loro_common.span uses a type in loro_common.
The types involved
loro_common.span.HasId → loro_common.ID
loro_common.span.HasIdSpan → loro_common.ID
loro_common.span.IdLpSpan → loro_common.IdLp
loro_common.span.IdSpan → loro_common.ID
Direction
loro_common.span uses loro_common, so a change to loro_common can break loro_common.span, while a change to loro_common.span can't break loro_common.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
8→10 loro_common.value uses loro_commonpart of a loop✕
Connections
1 pair of types, where a type in loro_common.value uses a type in loro_common.
loro_common.value uses loro_common, so a change to loro_common can break loro_common.value, while a change to loro_common.value can't break loro_common.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro-js.src.runtime.containers uses loro-js.src.runtime.document, so a change to loro-js.src.runtime.document can break loro-js.src.runtime.containers, while a change to loro-js.src.runtime.containers can't break loro-js.src.runtime.document.
Position
Below the diagonal: loro-js.src.runtime.containers uses a module listed above it, which is the healthy direction.
loro_common uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_common, while a change to loro_common can't break loro_common.internal_string.
Position
Below the diagonal: loro_common uses a module listed above it, which is the healthy direction.
loro_common uses loro_common.value, so a change to loro_common.value can break loro_common, while a change to loro_common can't break loro_common.value.
Position
Below the diagonal: loro_common uses a module listed above it, which is the healthy direction.
loro-js.src.runtime uses loro-js.src.runtime.document, so a change to loro-js.src.runtime.document can break loro-js.src.runtime, while a change to loro-js.src.runtime can't break loro-js.src.runtime.document.
Position
Below the diagonal: loro-js.src.runtime uses a module listed above it, which is the healthy direction.
loro-js.src.runtime uses loro-js.src.runtime.containers, so a change to loro-js.src.runtime.containers can break loro-js.src.runtime, while a change to loro-js.src.runtime can't break loro-js.src.runtime.containers.
Position
Below the diagonal: loro-js.src.runtime uses a module listed above it, which is the healthy direction.
loro_internal.container.idx uses loro_common, so a change to loro_common can break loro_internal.container.idx, while a change to loro_internal.container.idx can't break loro_common.
Position
Below the diagonal: loro_internal.container.idx uses a module listed above it, which is the healthy direction.
12→33 loro_internal.container.idx uses loro_internal.arenapart of a loop✕
Connections
1 pair of types, where a type in loro_internal.container.idx uses a type in loro_internal.arena.
loro_internal.container.idx uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.container.idx, while a change to loro_internal.container.idx can't break loro_internal.arena.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.container.richtext.tracker.crdt_rope uses generic_btree, so a change to generic_btree can break loro_internal.container.richtext.tracker.crdt_rope, while a change to loro_internal.container.richtext.tracker.crdt_rope can't break generic_btree.
Position
Below the diagonal: loro_internal.container.richtext.tracker.crdt_rope uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.crdt_rope uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.container.richtext.tracker.crdt_rope, while a change to loro_internal.container.richtext.tracker.crdt_rope can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.container.richtext.tracker.crdt_rope uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.crdt_rope uses loro_common.span, so a change to loro_common.span can break loro_internal.container.richtext.tracker.crdt_rope, while a change to loro_internal.container.richtext.tracker.crdt_rope can't break loro_common.span.
Position
Below the diagonal: loro_internal.container.richtext.tracker.crdt_rope uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.crdt_rope uses loro_common, so a change to loro_common can break loro_internal.container.richtext.tracker.crdt_rope, while a change to loro_internal.container.richtext.tracker.crdt_rope can't break loro_common.
Position
Below the diagonal: loro_internal.container.richtext.tracker.crdt_rope uses a module listed above it, which is the healthy direction.
13→18 loro_internal.container.richtext.tracker.crdt_rope uses loro_internal.container.richtext.style_range_mappart of a loop✕
Connections
3 pairs of types, where a type in loro_internal.container.richtext.tracker.crdt_rope uses a type in loro_internal.container.richtext.style_range_map.
loro_internal.container.richtext.tracker.crdt_rope uses loro_internal.container.richtext.style_range_map, so a change to loro_internal.container.richtext.style_range_map can break loro_internal.container.richtext.tracker.crdt_rope, while a change to loro_internal.container.richtext.tracker.crdt_rope can't break loro_internal.container.richtext.style_range_map.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.container.richtext.tracker.id_to_cursor uses generic_btree, so a change to generic_btree can break loro_internal.container.richtext.tracker.id_to_cursor, while a change to loro_internal.container.richtext.tracker.id_to_cursor can't break generic_btree.
Position
Below the diagonal: loro_internal.container.richtext.tracker.id_to_cursor uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.id_to_cursor uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.container.richtext.tracker.id_to_cursor, while a change to loro_internal.container.richtext.tracker.id_to_cursor can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.container.richtext.tracker.id_to_cursor uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.id_to_cursor uses loro_common.span, so a change to loro_common.span can break loro_internal.container.richtext.tracker.id_to_cursor, while a change to loro_internal.container.richtext.tracker.id_to_cursor can't break loro_common.span.
Position
Below the diagonal: loro_internal.container.richtext.tracker.id_to_cursor uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.tracker.id_to_cursor uses loro_common, so a change to loro_common can break loro_internal.container.richtext.tracker.id_to_cursor, while a change to loro_internal.container.richtext.tracker.id_to_cursor can't break loro_common.
Position
Below the diagonal: loro_internal.container.richtext.tracker.id_to_cursor uses a module listed above it, which is the healthy direction.
loro_internal.encoding.value uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.encoding.value, while a change to loro_internal.encoding.value can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.encoding.value uses a module listed above it, which is the healthy direction.
loro_internal.encoding.value uses loro_common.value, so a change to loro_common.value can break loro_internal.encoding.value, while a change to loro_internal.encoding.value can't break loro_common.value.
Position
Below the diagonal: loro_internal.encoding.value uses a module listed above it, which is the healthy direction.
loro_internal.encoding.value uses loro_common, so a change to loro_common can break loro_internal.encoding.value, while a change to loro_internal.encoding.value can't break loro_common.
Position
Below the diagonal: loro_internal.encoding.value uses a module listed above it, which is the healthy direction.
loro_internal.version.frontiers uses loro_common, so a change to loro_common can break loro_internal.version.frontiers, while a change to loro_internal.version.frontiers can't break loro_common.
Position
Below the diagonal: loro_internal.version.frontiers uses a module listed above it, which is the healthy direction.
loro_internal.change uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.change, while a change to loro_internal.change can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.change uses a module listed above it, which is the healthy direction.
loro_internal.change uses loro_common.span, so a change to loro_common.span can break loro_internal.change, while a change to loro_internal.change can't break loro_common.span.
Position
Below the diagonal: loro_internal.change uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in loro_internal.change uses a type in loro_common.
The types involved
loro_internal.change.Change → loro_common.ID
loro_internal.change.ChangeRef → loro_common.ID
Direction
loro_internal.change uses loro_common, so a change to loro_common can break loro_internal.change, while a change to loro_internal.change can't break loro_common.
Position
Below the diagonal: loro_internal.change uses a module listed above it, which is the healthy direction.
loro_internal.change uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.change, while a change to loro_internal.change can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.change uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.style_range_map uses generic_btree, so a change to generic_btree can break loro_internal.container.richtext.style_range_map, while a change to loro_internal.container.richtext.style_range_map can't break generic_btree.
Position
Below the diagonal: loro_internal.container.richtext.style_range_map uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.style_range_map uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.container.richtext.style_range_map, while a change to loro_internal.container.richtext.style_range_map can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.container.richtext.style_range_map uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.style_range_map uses loro_common.value, so a change to loro_common.value can break loro_internal.container.richtext.style_range_map, while a change to loro_internal.container.richtext.style_range_map can't break loro_common.value.
Position
Below the diagonal: loro_internal.container.richtext.style_range_map uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.style_range_map uses loro_internal.container.richtext.tracker.crdt_rope, so a change to loro_internal.container.richtext.tracker.crdt_rope can break loro_internal.container.richtext.style_range_map, while a change to loro_internal.container.richtext.style_range_map can't break loro_internal.container.richtext.tracker.crdt_rope.
Position
Below the diagonal: loro_internal.container.richtext.style_range_map uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses generic_btree, so a change to generic_btree can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break generic_btree.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_common.span, so a change to loro_common.span can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_common.span.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_common.value, so a change to loro_common.value can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_common.value.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_common, so a change to loro_common can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_common.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_internal.container.richtext.tracker.crdt_rope, so a change to loro_internal.container.richtext.tracker.crdt_rope can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_internal.container.richtext.tracker.crdt_rope.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.container.richtext.richtext_state uses loro_internal.container.richtext.style_range_map, so a change to loro_internal.container.richtext.style_range_map can break loro_internal.container.richtext.richtext_state, while a change to loro_internal.container.richtext.richtext_state can't break loro_internal.container.richtext.style_range_map.
Position
Below the diagonal: loro_internal.container.richtext.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses generic_btree, so a change to generic_btree can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break generic_btree.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses loro_common.span, so a change to loro_common.span can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_common.span.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses loro_common, so a change to loro_common can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_common.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
loro_internal.oplog.loro_dag uses loro_internal.change, so a change to loro_internal.change can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_internal.change.
Position
Below the diagonal: loro_internal.oplog.loro_dag uses a module listed above it, which is the healthy direction.
20→21 loro_internal.oplog.loro_dag uses loro_internal.versionpart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.oplog.loro_dag uses a type in loro_internal.version.
loro_internal.oplog.loro_dag uses loro_internal.version, so a change to loro_internal.version can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_internal.version.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→31 loro_internal.oplog.loro_dag uses loro_internal.oplog.change_storepart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.oplog.loro_dag uses a type in loro_internal.oplog.change_store.
loro_internal.oplog.loro_dag uses loro_internal.oplog.change_store, so a change to loro_internal.oplog.change_store can break loro_internal.oplog.loro_dag, while a change to loro_internal.oplog.loro_dag can't break loro_internal.oplog.change_store.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.version uses loro_common.span, so a change to loro_common.span can break loro_internal.version, while a change to loro_internal.version can't break loro_common.span.
Position
Below the diagonal: loro_internal.version uses a module listed above it, which is the healthy direction.
loro_internal.version uses loro_common, so a change to loro_common can break loro_internal.version, while a change to loro_internal.version can't break loro_common.
Position
Below the diagonal: loro_internal.version uses a module listed above it, which is the healthy direction.
loro_internal.version uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.version, while a change to loro_internal.version can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.version uses a module listed above it, which is the healthy direction.
loro_internal.version uses loro_internal.oplog.loro_dag, so a change to loro_internal.oplog.loro_dag can break loro_internal.version, while a change to loro_internal.version can't break loro_internal.oplog.loro_dag.
Position
Below the diagonal: loro_internal.version uses a module listed above it, which is the healthy direction.
loro_internal.diff_calc uses loro_common, so a change to loro_common can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_common.
Position
Below the diagonal: loro_internal.diff_calc uses a module listed above it, which is the healthy direction.
loro_internal.diff_calc uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.diff_calc uses a module listed above it, which is the healthy direction.
loro_internal.diff_calc uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.diff_calc uses a module listed above it, which is the healthy direction.
loro_internal.diff_calc uses loro_internal.version, so a change to loro_internal.version can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_internal.version.
Position
Below the diagonal: loro_internal.diff_calc uses a module listed above it, which is the healthy direction.
22→30 loro_internal.diff_calc uses loro_internal.oplogpart of a loop✕
Connections
8 pairs of types, where a type in loro_internal.diff_calc uses a type in loro_internal.oplog.
loro_internal.diff_calc uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_internal.oplog.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→32 loro_internal.diff_calc uses loro_internal.oppart of a loop✕
Connections
8 pairs of types, where a type in loro_internal.diff_calc uses a type in loro_internal.op.
loro_internal.diff_calc uses loro_internal.op, so a change to loro_internal.op can break loro_internal.diff_calc, while a change to loro_internal.diff_calc can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.history_cache uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_common.span, so a change to loro_common.span can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_common.span.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_common.value, so a change to loro_common.value can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_common.value.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_common, so a change to loro_common can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_common.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_internal.change, so a change to loro_internal.change can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.change.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_internal.container.richtext.richtext_state, so a change to loro_internal.container.richtext.richtext_state can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.container.richtext.richtext_state.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
loro_internal.history_cache uses loro_internal.version, so a change to loro_internal.version can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.version.
Position
Below the diagonal: loro_internal.history_cache uses a module listed above it, which is the healthy direction.
23→30 loro_internal.history_cache uses loro_internal.oplogpart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.history_cache uses a type in loro_internal.oplog.
loro_internal.history_cache uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.oplog.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→31 loro_internal.history_cache uses loro_internal.oplog.change_storepart of a loop✕
Connections
1 pair of types, where a type in loro_internal.history_cache uses a type in loro_internal.oplog.change_store.
loro_internal.history_cache uses loro_internal.oplog.change_store, so a change to loro_internal.oplog.change_store can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.oplog.change_store.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→32 loro_internal.history_cache uses loro_internal.oppart of a loop✕
Connections
7 pairs of types, where a type in loro_internal.history_cache uses a type in loro_internal.op.
loro_internal.history_cache uses loro_internal.op, so a change to loro_internal.op can break loro_internal.history_cache, while a change to loro_internal.history_cache can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.oplog.known_history uses loro_common.value, so a change to loro_common.value can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_common.value.
Position
Below the diagonal: loro_internal.oplog.known_history uses a module listed above it, which is the healthy direction.
loro_internal.oplog.known_history uses loro_common, so a change to loro_common can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_common.
Position
Below the diagonal: loro_internal.oplog.known_history uses a module listed above it, which is the healthy direction.
loro_internal.oplog.known_history uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.oplog.known_history uses a module listed above it, which is the healthy direction.
loro_internal.oplog.known_history uses loro_internal.change, so a change to loro_internal.change can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.change.
Position
Below the diagonal: loro_internal.oplog.known_history uses a module listed above it, which is the healthy direction.
loro_internal.oplog.known_history uses loro_internal.version, so a change to loro_internal.version can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.version.
Position
Below the diagonal: loro_internal.oplog.known_history uses a module listed above it, which is the healthy direction.
24→30 loro_internal.oplog.known_history uses loro_internal.oplogpart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.oplog.known_history uses a type in loro_internal.oplog.
loro_internal.oplog.known_history uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.oplog.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→32 loro_internal.oplog.known_history uses loro_internal.oppart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.oplog.known_history uses a type in loro_internal.op.
loro_internal.oplog.known_history uses loro_internal.op, so a change to loro_internal.op can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
24→33 loro_internal.oplog.known_history uses loro_internal.arenapart of a loop✕
Connections
1 pair of types, where a type in loro_internal.oplog.known_history uses a type in loro_internal.arena.
loro_internal.oplog.known_history uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.oplog.known_history, while a change to loro_internal.oplog.known_history can't break loro_internal.arena.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.event uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.event, while a change to loro_internal.event can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.event uses loro_common, so a change to loro_common can break loro_internal.event, while a change to loro_internal.event can't break loro_common.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.event uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.event, while a change to loro_internal.event can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.event uses loro_internal.encoding.value, so a change to loro_internal.encoding.value can break loro_internal.event, while a change to loro_internal.event can't break loro_internal.encoding.value.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.event uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.event, while a change to loro_internal.event can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.event uses loro_internal.diff_calc, so a change to loro_internal.diff_calc can break loro_internal.event, while a change to loro_internal.event can't break loro_internal.diff_calc.
Position
Below the diagonal: loro_internal.event uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses generic_btree, so a change to generic_btree can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break generic_btree.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_common.value, so a change to loro_common.value can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_common.value.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_common, so a change to loro_common can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_common.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_internal.container.richtext.tracker.crdt_rope, so a change to loro_internal.container.richtext.tracker.crdt_rope can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.container.richtext.tracker.crdt_rope.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_internal.container.richtext.style_range_map, so a change to loro_internal.container.richtext.style_range_map can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.container.richtext.style_range_map.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.list_state uses loro_internal.event, so a change to loro_internal.event can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.event.
Position
Below the diagonal: loro_internal.state.list_state uses a module listed above it, which is the healthy direction.
26→29 loro_internal.state.list_state uses loro_internal.statepart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.state.list_state uses a type in loro_internal.state.
loro_internal.state.list_state uses loro_internal.state, so a change to loro_internal.state can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.state.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
26→32 loro_internal.state.list_state uses loro_internal.oppart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.state.list_state uses a type in loro_internal.op.
loro_internal.state.list_state uses loro_internal.op, so a change to loro_internal.op can break loro_internal.state.list_state, while a change to loro_internal.state.list_state can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.state.movable_list_state uses generic_btree, so a change to generic_btree can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break generic_btree.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses loro_common.value, so a change to loro_common.value can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_common.value.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses loro_common, so a change to loro_common can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_common.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
loro_internal.state.movable_list_state uses loro_internal.event, so a change to loro_internal.event can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_internal.event.
Position
Below the diagonal: loro_internal.state.movable_list_state uses a module listed above it, which is the healthy direction.
27→29 loro_internal.state.movable_list_state uses loro_internal.statepart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.state.movable_list_state uses a type in loro_internal.state.
loro_internal.state.movable_list_state uses loro_internal.state, so a change to loro_internal.state can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_internal.state.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
27→32 loro_internal.state.movable_list_state uses loro_internal.oppart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.state.movable_list_state uses a type in loro_internal.op.
loro_internal.state.movable_list_state uses loro_internal.op, so a change to loro_internal.op can break loro_internal.state.movable_list_state, while a change to loro_internal.state.movable_list_state can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.state.tree_state uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.state.tree_state uses a module listed above it, which is the healthy direction.
loro_internal.state.tree_state uses loro_common.value, so a change to loro_common.value can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_common.value.
Position
Below the diagonal: loro_internal.state.tree_state uses a module listed above it, which is the healthy direction.
loro_internal.state.tree_state uses loro_common, so a change to loro_common can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_common.
Position
Below the diagonal: loro_internal.state.tree_state uses a module listed above it, which is the healthy direction.
loro_internal.state.tree_state uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.state.tree_state uses a module listed above it, which is the healthy direction.
loro_internal.state.tree_state uses loro_internal.event, so a change to loro_internal.event can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_internal.event.
Position
Below the diagonal: loro_internal.state.tree_state uses a module listed above it, which is the healthy direction.
28→29 loro_internal.state.tree_state uses loro_internal.statepart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.state.tree_state uses a type in loro_internal.state.
loro_internal.state.tree_state uses loro_internal.state, so a change to loro_internal.state can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_internal.state.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
28→32 loro_internal.state.tree_state uses loro_internal.oppart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.state.tree_state uses a type in loro_internal.op.
loro_internal.state.tree_state uses loro_internal.op, so a change to loro_internal.op can break loro_internal.state.tree_state, while a change to loro_internal.state.tree_state can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.state uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.state, while a change to loro_internal.state can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_common.value, so a change to loro_common.value can break loro_internal.state, while a change to loro_internal.state can't break loro_common.value.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_common, so a change to loro_common can break loro_internal.state, while a change to loro_internal.state can't break loro_common.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.container.richtext.richtext_state, so a change to loro_internal.container.richtext.richtext_state can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.container.richtext.richtext_state.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.version, so a change to loro_internal.version can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.version.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.diff_calc, so a change to loro_internal.diff_calc can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.diff_calc.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.event, so a change to loro_internal.event can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.event.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.state.list_state, so a change to loro_internal.state.list_state can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.state.list_state.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.state.movable_list_state, so a change to loro_internal.state.movable_list_state can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.state.movable_list_state.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
loro_internal.state uses loro_internal.state.tree_state, so a change to loro_internal.state.tree_state can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.state.tree_state.
Position
Below the diagonal: loro_internal.state uses a module listed above it, which is the healthy direction.
29→30 loro_internal.state uses loro_internal.oplogpart of a loop✕
Connections
1 pair of types, where a type in loro_internal.state uses a type in loro_internal.oplog.
loro_internal.state uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.oplog.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→32 loro_internal.state uses loro_internal.oppart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.state uses a type in loro_internal.op.
loro_internal.state uses loro_internal.op, so a change to loro_internal.op can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→33 loro_internal.state uses loro_internal.arenapart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.state uses a type in loro_internal.arena.
loro_internal.state uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.state, while a change to loro_internal.state can't break loro_internal.arena.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.oplog uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_common.span, so a change to loro_common.span can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_common.span.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_common, so a change to loro_common can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_common.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.change, so a change to loro_internal.change can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.change.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.oplog.loro_dag, so a change to loro_internal.oplog.loro_dag can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.oplog.loro_dag.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.version, so a change to loro_internal.version can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.version.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.diff_calc, so a change to loro_internal.diff_calc can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.diff_calc.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.history_cache, so a change to loro_internal.history_cache can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.history_cache.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.oplog.known_history, so a change to loro_internal.oplog.known_history can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.oplog.known_history.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
loro_internal.oplog uses loro_internal.state, so a change to loro_internal.state can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.state.
Position
Below the diagonal: loro_internal.oplog uses a module listed above it, which is the healthy direction.
30→31 loro_internal.oplog uses loro_internal.oplog.change_storepart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.oplog uses a type in loro_internal.oplog.change_store.
loro_internal.oplog uses loro_internal.oplog.change_store, so a change to loro_internal.oplog.change_store can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.oplog.change_store.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
30→32 loro_internal.oplog uses loro_internal.oppart of a loop✕
Connections
1 pair of types, where a type in loro_internal.oplog uses a type in loro_internal.op.
loro_internal.oplog uses loro_internal.op, so a change to loro_internal.op can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
30→33 loro_internal.oplog uses loro_internal.arenapart of a loop✕
Connections
4 pairs of types, where a type in loro_internal.oplog uses a type in loro_internal.arena.
loro_internal.oplog uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.arena.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
30→39 loro_internal.oplog uses loro_internal.encodingpart of a loop✕
Connections
1 pair of types, where a type in loro_internal.oplog uses a type in loro_internal.encoding.
loro_internal.oplog uses loro_internal.encoding, so a change to loro_internal.encoding can break loro_internal.oplog, while a change to loro_internal.oplog can't break loro_internal.encoding.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.oplog.change_store uses loro_common.span, so a change to loro_common.span can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_common.span.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_common, so a change to loro_common can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_common.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.change, so a change to loro_internal.change can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.change.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.oplog.loro_dag, so a change to loro_internal.oplog.loro_dag can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.oplog.loro_dag.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.version, so a change to loro_internal.version can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.version.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.oplog.known_history, so a change to loro_internal.oplog.known_history can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.oplog.known_history.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
loro_internal.oplog.change_store uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.oplog.
Position
Below the diagonal: loro_internal.oplog.change_store uses a module listed above it, which is the healthy direction.
31→32 loro_internal.oplog.change_store uses loro_internal.oppart of a loop✕
Connections
1 pair of types, where a type in loro_internal.oplog.change_store uses a type in loro_internal.op.
loro_internal.oplog.change_store uses loro_internal.op, so a change to loro_internal.op can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.op.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
31→33 loro_internal.oplog.change_store uses loro_internal.arenapart of a loop✕
Connections
7 pairs of types, where a type in loro_internal.oplog.change_store uses a type in loro_internal.arena.
loro_internal.oplog.change_store uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.oplog.change_store, while a change to loro_internal.oplog.change_store can't break loro_internal.arena.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.op uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.op, while a change to loro_internal.op can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.op uses loro_common.span, so a change to loro_common.span can break loro_internal.op, while a change to loro_internal.op can't break loro_common.span.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.op uses loro_common.value, so a change to loro_common.value can break loro_internal.op, while a change to loro_internal.op can't break loro_common.value.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.op uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.op, while a change to loro_internal.op can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.op uses loro_internal.change, so a change to loro_internal.change can break loro_internal.op, while a change to loro_internal.op can't break loro_internal.change.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.op uses loro_internal.oplog.change_store, so a change to loro_internal.oplog.change_store can break loro_internal.op, while a change to loro_internal.op can't break loro_internal.oplog.change_store.
Position
Below the diagonal: loro_internal.op uses a module listed above it, which is the healthy direction.
loro_internal.arena uses loro_common, so a change to loro_common can break loro_internal.arena, while a change to loro_internal.arena can't break loro_common.
Position
Below the diagonal: loro_internal.arena uses a module listed above it, which is the healthy direction.
loro_internal.arena uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.arena, while a change to loro_internal.arena can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.arena uses a module listed above it, which is the healthy direction.
loro_internal.arena uses loro_internal.op, so a change to loro_internal.op can break loro_internal.arena, while a change to loro_internal.arena can't break loro_internal.op.
Position
Below the diagonal: loro_internal.arena uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.loro, while a change to loro_internal.loro can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_common, so a change to loro_common can break loro_internal.loro, while a change to loro_internal.loro can't break loro_common.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.version, so a change to loro_internal.version can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.version.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.diff_calc, so a change to loro_internal.diff_calc can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.diff_calc.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.event, so a change to loro_internal.event can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.event.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.state, so a change to loro_internal.state can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.state.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.oplog.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
loro_internal.loro uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.arena.
Position
Below the diagonal: loro_internal.loro uses a module listed above it, which is the healthy direction.
34→36 loro_internal.loro uses loro_internal.handlerpart of a loop✕
Connections
1 pair of types, where a type in loro_internal.loro uses a type in loro_internal.handler.
loro_internal.loro uses loro_internal.handler, so a change to loro_internal.handler can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.handler.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
34→37 loro_internal.loro uses loro_internalpart of a loop✕
Connections
2 pairs of types, where a type in loro_internal.loro uses a type in loro_internal.
loro_internal.loro uses loro_internal, so a change to loro_internal can break loro_internal.loro, while a change to loro_internal.loro can't break loro_internal.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.txn uses generic_btree.rle, so a change to generic_btree.rle can break loro_internal.txn, while a change to loro_internal.txn can't break generic_btree.rle.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.txn, while a change to loro_internal.txn can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_common.span, so a change to loro_common.span can break loro_internal.txn, while a change to loro_internal.txn can't break loro_common.span.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in loro_internal.txn uses a type in loro_common.
The types involved
loro_internal.txn.Transaction → loro_common.ID
loro_internal.txn.Transaction → loro_common.IdLp
Direction
loro_internal.txn uses loro_common, so a change to loro_common can break loro_internal.txn, while a change to loro_internal.txn can't break loro_common.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.change, so a change to loro_internal.change can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.change.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.event, so a change to loro_internal.event can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.event.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.op, so a change to loro_internal.op can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.op.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.arena.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
loro_internal.txn uses loro_internal.loro, so a change to loro_internal.loro can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.loro.
Position
Below the diagonal: loro_internal.txn uses a module listed above it, which is the healthy direction.
35→36 loro_internal.txn uses loro_internal.handlerpart of a loop✕
Connections
3 pairs of types, where a type in loro_internal.txn uses a type in loro_internal.handler.
loro_internal.txn uses loro_internal.handler, so a change to loro_internal.handler can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.handler.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
35→37 loro_internal.txn uses loro_internalpart of a loop✕
Connections
3 pairs of types, where a type in loro_internal.txn uses a type in loro_internal.
loro_internal.txn uses loro_internal, so a change to loro_internal can break loro_internal.txn, while a change to loro_internal.txn can't break loro_internal.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.handler uses loro_common.value, so a change to loro_common.value can break loro_internal.handler, while a change to loro_internal.handler can't break loro_common.value.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_common, so a change to loro_common can break loro_internal.handler, while a change to loro_internal.handler can't break loro_common.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_internal.container.richtext.richtext_state, so a change to loro_internal.container.richtext.richtext_state can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.container.richtext.richtext_state.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_internal.event, so a change to loro_internal.event can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.event.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
loro_internal.handler uses loro_internal.txn, so a change to loro_internal.txn can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.txn.
Position
Below the diagonal: loro_internal.handler uses a module listed above it, which is the healthy direction.
36→37 loro_internal.handler uses loro_internalpart of a loop✕
Connections
10 pairs of types, where a type in loro_internal.handler uses a type in loro_internal.
loro_internal.handler uses loro_internal, so a change to loro_internal can break loro_internal.handler, while a change to loro_internal.handler can't break loro_internal.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal, while a change to loro_internal can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal, while a change to loro_internal can't break loro_internal.configure.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in loro_internal uses a type in loro_common.span.
The types involved
loro_internal.LoroDoc → loro_common.span.IdSpan
Direction
loro_internal uses loro_common.span, so a change to loro_common.span can break loro_internal, while a change to loro_internal can't break loro_common.span.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_common.value, so a change to loro_common.value can break loro_internal, while a change to loro_internal can't break loro_common.value.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro_internal, while a change to loro_internal can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal, while a change to loro_internal can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.version, so a change to loro_internal.version can break loro_internal, while a change to loro_internal can't break loro_internal.version.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.oplog.known_history, so a change to loro_internal.oplog.known_history can break loro_internal, while a change to loro_internal can't break loro_internal.oplog.known_history.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.event, so a change to loro_internal.event can break loro_internal, while a change to loro_internal can't break loro_internal.event.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.arena, so a change to loro_internal.arena can break loro_internal, while a change to loro_internal can't break loro_internal.arena.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.loro, so a change to loro_internal.loro can break loro_internal, while a change to loro_internal can't break loro_internal.loro.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.txn, so a change to loro_internal.txn can break loro_internal, while a change to loro_internal can't break loro_internal.txn.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
loro_internal uses loro_internal.handler, so a change to loro_internal.handler can break loro_internal, while a change to loro_internal can't break loro_internal.handler.
Position
Below the diagonal: loro_internal uses a module listed above it, which is the healthy direction.
37→39 loro_internal uses loro_internal.encodingpart of a loop✕
Connections
2 pairs of types, where a type in loro_internal uses a type in loro_internal.encoding.
loro_internal uses loro_internal.encoding, so a change to loro_internal.encoding can break loro_internal, while a change to loro_internal can't break loro_internal.encoding.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
loro_internal.state.richtext_state uses loro_internal.configure, so a change to loro_internal.configure can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.configure.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_common.value, so a change to loro_common.value can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_common.value.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_common, so a change to loro_common can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_common.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.container.idx, so a change to loro_internal.container.idx can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.container.idx.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.container.richtext.richtext_state, so a change to loro_internal.container.richtext.richtext_state can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.container.richtext.richtext_state.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.event, so a change to loro_internal.event can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.event.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.state, so a change to loro_internal.state can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.state.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.op, so a change to loro_internal.op can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.op.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.state.richtext_state uses loro_internal.handler, so a change to loro_internal.handler can break loro_internal.state.richtext_state, while a change to loro_internal.state.richtext_state can't break loro_internal.handler.
Position
Below the diagonal: loro_internal.state.richtext_state uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_common.internal_string, so a change to loro_common.internal_string can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_common.internal_string.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_common, so a change to loro_common can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_common.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal.change, so a change to loro_internal.change can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.change.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal.version, so a change to loro_internal.version can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.version.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal.oplog.known_history, so a change to loro_internal.oplog.known_history can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.oplog.known_history.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal.oplog, so a change to loro_internal.oplog can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.oplog.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro_internal.encoding uses loro_internal, so a change to loro_internal can break loro_internal.encoding, while a change to loro_internal.encoding can't break loro_internal.
Position
Below the diagonal: loro_internal.encoding uses a module listed above it, which is the healthy direction.
loro uses loro_internal.container.richtext.tracker.id_to_cursor, so a change to loro_internal.container.richtext.tracker.id_to_cursor can break loro, while a change to loro can't break loro_internal.container.richtext.tracker.id_to_cursor.
Position
Below the diagonal: loro uses a module listed above it, which is the healthy direction.
loro uses loro_internal.version.frontiers, so a change to loro_internal.version.frontiers can break loro, while a change to loro can't break loro_internal.version.frontiers.
Position
Below the diagonal: loro uses a module listed above it, which is the healthy direction.
loro uses loro_internal.state.tree_state, so a change to loro_internal.state.tree_state can break loro, while a change to loro can't break loro_internal.state.tree_state.
Position
Below the diagonal: loro uses a module listed above it, which is the healthy direction.
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2025 — Software Supply Chain Failures
105
High / Critical
A05:2025 — Injection
46
High / Critical
A02:2025 — Security Misconfiguration
12
High / Critical
Roadmap
Top priorities: Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package; Interpolated log message defeats structured logging; Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
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 `?`).
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).
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 — 97
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 — 1270
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 — 108
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 60 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 60 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1432 of 1475 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 950 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 280 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT 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/ (526 tests); vitest via `pnpm install --frozen-lockfile --ignore-scripts` in packages/fractional-index/ (20 tests)): measured (2 flaky) suite(s) did re-run, and came back with 2 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares 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.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `crates/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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads 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.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev`) exited before it served a page. Likely cause (the repository): REDACTED has no "dev" script, so `npm run dev` could not start the app. Last output: "npm error Missing script: "dev" / npm error / npm error To see a list of scripts, run: / npm error npm run / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 91 further occurrence(s) are not listed individually; the score already reflects all 131.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 87 further occurrence(s) are not listed individually; the score already reflects all 127.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
146 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.
+ 99 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 183 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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.7 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.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.
Resolve the 45 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 (45 warning-level).
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).
Resolve the 32 TooManyMethods finding(s) in God Classes — start with lib.rs (7), containers.ts (3), handler.rs (3). — One of this dimension's main actionable groups (32 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
187 duplicated block group(s) detected. 5.5 % of the production lines (8,628 of 156,417) are in a reported copy. A further 142 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 43 of the 329 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.
+ 124 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 18 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with handler.rs (6), lib.rs (2), style_range_map.rs (2). — One of this dimension's main actionable groups (18 warning-level).
Resolve the 13 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with handler.rs (3), lib.rs, diff_calc.rs. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 11 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with value.rs (2), block_encode.rs (2), handler.rs. — One of this dimension's main actionable groups (11 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
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 17 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
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Unstable project loro (Cargo) finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with lib.rs, version.rs, value.rs. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
13 skipped (11 with a documented reason), 23 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 950 tests. Measured on the JavaScript/TypeScript suite only — at least 280 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
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).
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).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
23 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 · ×23
What to do
Resolve the 1 Yanked release finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 321 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.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: REDACTED (23×100=2300); crates/loro-internal/src/loro.rs (26×48=1248); crates/loro-internal/src/oplog.rs (23×26=598) Repeated repair below the complexity floor: crates/loro-internal/src/undo.rs (13 of 14 changes were fixes); crates/loro-wasm/src/lib.rs (9 of 15 changes were fixes); crates/loro-internal/src/oplog/pending_changes.rs (8 of 9 changes were fixes)
Resolve the 19 Repeated repair finding(s) in Churn × Complexity Hotspots — start with tree.rs (2), undo.rs, lib.rs. — One of this dimension's main actionable groups (19 warning-level).
Resolve the 18 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED, loro.rs, oplog.rs. — One of this dimension's main actionable groups (18 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.7 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
27 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is REDACTED. Counted over 202 of the 272 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)
What to do
Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
93 deducted task-comment markers across 156417 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.
Resolve the 88 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 (88 warning-level).
Resolve the 5 FixmeComment finding(s) in Explicit Debt — start with loro.rs, container_wrapper.rs, undo_test.rs. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 2 documentation facets pass in full; short on: F2 example. 26 document(s) read across 5 unit(s).
Documentation: no build, run or usage examplecrates/loro-wasm-map/README.md:1
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
Resolve the 6 redundant comment finding(s) in Comment Value — start with basic.test.ts (2), richtext.test.ts (2), build.ts. — One of this dimension's main actionable groups (6 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
2 of 18 build units (Cargo, Deno, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
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.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
46 finding(s): 0 critical, 40 high, 6 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 314, line 316, line 318, …), `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
+ 7 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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).
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).
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.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 40 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (32), REDACTED (4), REDACTED (3). — One of this dimension's main actionable groups (40 issue-level).
Resolve the 20 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (20). — One of this dimension's main actionable groups (20 warning-level).
Resolve the 5 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (5 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
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.
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.
12 of 202 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 202 of the 272 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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).
Resolve the 11 Orphaned file finding(s) in Knowledge Freshness — start with ast.rs, dfs.rs, mem_kv_fuzzer.rs. — One of this dimension's main actionable groups (11 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
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.
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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — 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.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
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.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
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.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
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.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability6.5 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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.
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.
`REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — REDACTED:36
What to do
Your ecosystem's static analyzer is declared as a dependency but is not wired into CI — run it as a required step on push/PR (e.g. `composer phpstan` / `mix sobelow` / `bundle exec brakeman` / the spotbugs Gradle task / `sbt scalafixAll --check` / `golangci-lint run` / `rebar3 lint`) so a regression fails the build instead of relying on someone running it locally.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
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 we 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.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety9.2 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
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.
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
recomputeVisibility has cyclomatic complexity 24 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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/runtime/sequence-index.ts:3074
lookupChild has cyclomatic complexity 23 and cognitive complexity 33; 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:369
fugueInsertion has cyclomatic complexity 23 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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/runtime/containers.ts:3598
recompute has cyclomatic complexity 23 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:3131
decodedOperationToJson has cyclomatic complexity 23 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:9917
assertTwinAgrees has cyclomatic complexity 22 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/differential/harness.ts:385
writeSleb128 has cyclomatic complexity 22 and cognitive complexity 25; 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/leb128.ts:94
containerDiff has cyclomatic complexity 21 and cognitive complexity 30; 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:10702
encodeChangeBlock has cyclomatic complexity 21 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/codec/change-block-codec.ts:234
styleValuesEqual has cyclomatic complexity 21 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/runtime/containers.ts:2491
rewrite has cyclomatic complexity 20 and cognitive complexity 37; 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/sstable.ts:162
indexedFugueInsertion has cyclomatic complexity 20 and cognitive complexity 37; 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/containers.ts:3721
visitVisibleStorageRange has cyclomatic complexity 20 and cognitive complexity 36; 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:3770
#finishSpanAppend has cyclomatic complexity 20 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/sequence-index.ts:2237
alignText has cyclomatic complexity 20 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 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:11328
#appendToPreviousNodeWithLineBreaks has cyclomatic complexity 20 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/src/runtime/sequence-index.ts:2143
generateEdit has cyclomatic complexity 20 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — loro-js/tests/differential/fuzz.ts:324
containerPath has cyclomatic complexity 19 and cognitive complexity 33; 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:11461
#markLocatedIdSpanVisibility has cyclomatic complexity 19 and cognitive complexity 32; 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:1292
visitVisibleIdRuns has cyclomatic complexity 19 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/sequence-index.ts:3469
Do you agree with this assessment?
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 507 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 462 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.
Do you agree with this assessment?
R4 · Test Coverage7.5 / 10Strong✓ 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. (×13) — 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).
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each 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.
Do you agree with this assessment?
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.
77 file(s) (~14821 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: crates/loro-wasm/tests/apply_diff_atomicity.test.ts imports '../bundler/index', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — crates/loro-wasm
Unreachable from the 63 application, 10 tooling and 115 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 (63 application, 10 tooling, 115 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×3) — scripts/run-js-doc-tests.ts, crates/loro-internal/scripts/fuzz.ts, crates/loro-internal/scripts/run_mem.ts
no import path from any entry point (63 application, 10 tooling, 115 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.
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 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.
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — 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:355
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.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `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 531 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:531
`info!` at line 544 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:544
`info!` at line 551 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:551
`error!` at line 2380 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:2380
`error!` at line 3763 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:3763
`warn!` at line 4580 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:4580
`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 3947 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:3947
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.5 `!` null assertions per 1k TypeScript source lines — 565 assertion(s) across the 34145 source line(s) of the 49 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. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
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.
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 — 67 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not 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
AX6 Interface segregation — AX6 reached only 23% of this repository's production lines — rust (123,779 lines), python (152 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the dev server (`npm run dev`) exited before it served a page. Likely cause (the repository): REDACTED has no "dev" script, so `npm run dev` could not start the app. Last output: "npm error Missing script: "dev" / npm error / npm error To see a list of scripts, run: / npm error npm run / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository starts no server another machine can reach (no actix-web HttpServer, axum::serve, Rocket launch, warp::serve, poem or salvo Server, tonic Server::builder, hyper or tiny_http server outside examples and tests, none bound beyond loopback). Access control is therefore N/A here — a crate is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D21 Naming Consistency — D21 withholds its case and prefix conventions rows: 9 candidate(s) found and not reported.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. 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"]`.
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.
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.
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 — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — uses a 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.
X12 Unreachable branch — X12 reached only 23% of this repository's production lines — rust (123,779 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 23% of this repository's production lines — rust (123,779 lines), python (152 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — X17 reached only 23% of this repository's production lines — rust (123,779 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — X25 reached only 23% of this repository's production lines — rust (123,779 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X26 Unsynchronised callback handoff — Not applicable: 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.
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X3 Exception handling — X3 reached only 23% of this repository's production lines — rust (123,779 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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.
Flaky test: loro-js/tests/import-atomicity.test.ts:: import is atomic an import costs the same however many texts a snapshot hydrated — Passed 2×, failed 1× across repeated runs.
Flaky test: loro-js/tests/movable-list.test.ts:: MovableList versions, undo and diffs checkout and diff stay linear in the number of inserts — Passed 2×, failed 1× across repeated runs.
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.
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:2120— // 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:5067— // 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:5437— // 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:6470— // 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:585— // 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/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:157— // 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:1266— /// 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:2298— // 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:2303— // 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:2307— // 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:2309— // 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:2323— // 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:324— // 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:2513— // 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:2683— // 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.
TodoComment crates/loro-internal/src/loro.rs:1828— // TODO: test when the doc is readonly — 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.
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 — 3358 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 2858 over it, 6.72× 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 — 3247 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 43 free functions. The bar is 500 significant lines; this is 2747 over it, 6.49× 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 — 2801 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 88% of them inside a single declaration: LoroDoc (3 blocks, 97-4396). The bar is 500 significant lines; this is 2301 over it, 5.60× 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 — 1660 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 80% of them inside a single declaration: DocState (3 blocks, 159-2655). The bar is 500 significant lines; this is 1160 over it, 3.32× 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 — 1620 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 1120 over it, 3.24× 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 — 1515 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 1015 over it, 3.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/loro/src/lib.rs— FileTooLong — 1354 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 854 over it, 2.71× 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/tree_state.rs crates/loro-internal/src/state/tree_state.rs— FileTooLong — 1283 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 783 over it, 2.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: state/movable_list_state.rs crates/loro-internal/src/state/movable_list_state.rs— FileTooLong — 1171 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 671 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: src/oplog.rs crates/loro-internal/src/oplog.rs— FileTooLong — 1110 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: OpLog (3 blocks, 52-1806). The bar is 500 significant lines; this is 610 over it, 2.22× 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 — 1079 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: AppDag (4 blocks, 30-1721). The bar is 500 significant lines; this is 579 over it, 2.16× 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: state/richtext_state.rs crates/loro-internal/src/state/richtext_state.rs— FileTooLong — 1067 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 61% of them inside a single declaration: RichtextState (5 blocks, 42-1136). The bar is 500 significant lines; this is 567 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: encoding/value.rs crates/loro-internal/src/encoding/value.rs— FileTooLong — 895 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 395 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: src/lib.rs crates/loro-common/src/lib.rs— FileTooLong — 808 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 308 over it, 1.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: 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 — 803 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 303 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: 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/value.rs crates/loro-common/src/value.rs— FileTooLong — 751 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 251 over it, 1.50× 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.
loro_internal::dag::_find_meet_and_mode (cognitive 123) crates/loro-internal/src/dag.rs:740— 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 82) crates/loro-internal/src/dag.rs:442— loro_internal::dag::_walk_to_meet has cognitive complexity 82 (threshold 15). Drivers by points: if/else 21 (58 pts), match/switch 7 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:113— 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:364— 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:185— 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:968— 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:4165— 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:663— 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::version::try_shrink_frontiers (cognitive 30) crates/loro-internal/src/version.rs:1009— loro_internal::version::try_shrink_frontiers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 3 (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.
loro_internal::state::trigger_on_new_container (cognitive 29) crates/loro-internal/src/state.rs:2679— 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:1403— 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:942— 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::oplog::change_store::block_encode::decode_block (cognitive 24) crates/loro-internal/src/oplog/change_store/block_encode.rs:610— loro_internal::oplog::change_store::block_encode::decode_block has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4, match/switch 2 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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:1565— MethodTooLong — undo_internal_with runs 191 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 91 over it, 1.91× 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:1626— 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:973— 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:627— 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:2148— 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:2456— 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: OpLog.try_iter_from_replay_base_causally_filtered crates/loro-internal/src/oplog.rs:1269— MethodTooLong — try_iter_from_replay_base_causally_filtered runs 140 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 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ValueReader.recursive_read_value_type_and_content crates/loro-internal/src/encoding/value.rs:691— MethodTooLong — recursive_read_value_type_and_content runs 134 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RichtextDiffCalculator.calculate_diff crates/loro-internal/src/diff_calc.rs:1829— MethodTooLong — calculate_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: Handler.apply_diff crates/loro-internal/src/handler.rs:1368— 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:391— 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:2592— 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: LoroDoc.query_pos_internal crates/loro-internal/src/loro.rs:3698— 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:1276— 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: 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.
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 — 173 methods, declared across 9 files: src/loro.rs (155), src/txn.rs (9), src/fork.rs (2), jsonpath/jsonpath_impl.rs (2), +5 more file(s). The bar is 30 methods; this is 143 over it, 5.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: LoroDoc crates/loro/src/lib.rs:122— TooManyMethods — 117 methods. The bar is 30 methods; this is 87 over it, 3.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: DocState crates/loro-internal/src/state.rs:159— TooManyMethods — 102 methods, declared across 6 files: src/state.rs (87), state/container_tree.rs (5), state/mergeable.rs (4), src/parent.rs (2), +2 more file(s). The bar is 30 methods; this is 72 over it, 3.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OpLog crates/loro-internal/src/oplog.rs:52— TooManyMethods — 101 methods, declared across 5 files: src/oplog.rs (86), oplog/known_history.rs (9), oplog/pending_changes.rs (4), encoding/fast_snapshot.rs (1), +1 more file(s). The bar is 30 methods; this is 71 over it, 3.37× 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:306— TooManyMethods — 85 methods, declared across 2 files: src/lib.rs (83), src/container_tree.rs (2). The bar is 30 methods; this is 55 over it, 2.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: 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: AppDag crates/loro-internal/src/oplog/loro_dag.rs:30— TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ChangeStore crates/loro-internal/src/oplog/change_store.rs:77— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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: MovableListHandler crates/loro-internal/src/handler.rs:788— TooManyMethods — 47 methods, declared across 2 files: src/handler.rs (40), handler/movable_list_apply_delta.rs (7). The bar is 30 methods; this is 17 over it, 1.57× 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: ContainerStore crates/loro-internal/src/state/container_store.rs:41— 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: 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: 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: ContainerWrapper crates/loro-internal/src/state/container_store/container_wrapper.rs:21— 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: 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: InnerStore crates/loro-internal/src/state/container_store/inner_store.rs:29— 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: RichtextState crates/loro-internal/src/state/richtext_state.rs:42— 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: LoroMovableList crates/loro-wasm/src/lib.rs:4506— TooManyMethods — 35 methods, declared across 2 files: src/lib.rs (33), src/container_tree.rs (2). The bar is 30 methods; this is 5 over it, 1.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: LoroText crates/loro/src/lib.rs:2842— 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:200— 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.
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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: #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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: avoid rust recursive use error crates/loro-wasm/tests/undo.test.ts:676— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
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 — 1327 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 102 methods, 3 blocks, lines 159-2655. The bar is 400 significant lines; this is 927 over it, 3.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TextHandler crates/loro-internal/src/handler.rs:451— ClassTooLong — 1034 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-3076. The bar is 400 significant lines; this is 634 over it, 2.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: 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: AppDag crates/loro-internal/src/oplog/loro_dag.rs:30— ClassTooLong — 924 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 59 methods, 4 blocks, lines 30-1721. The bar is 400 significant lines; this is 524 over it, 2.31× 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:52— ClassTooLong — 918 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 101 methods, 3 blocks, lines 52-1806. The bar is 400 significant lines; this is 518 over it, 2.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.
ClassTooLong: LoroDoc crates/loro-wasm/src/lib.rs:306— 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), 85 methods, 4 blocks, lines 306-2850. 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: RichtextState crates/loro-internal/src/state/richtext_state.rs:42— 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 42-1136. 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: RichtextDiffCalculator crates/loro-internal/src/diff_calc.rs:1115— ClassTooLong — 591 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 1115-2073. The bar is 400 significant lines; this is 191 over it, 1.48× 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 — 581 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 47 methods, 4 blocks, lines 788-4501. The bar is 400 significant lines; this is 181 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: 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: 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 — 468 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 2 blocks, lines 21-856. The bar is 400 significant lines; this is 68 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.
ClassTooLong: Tracker crates/loro-internal/src/container/richtext/tracker.rs:32— ClassTooLong — 460 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 29 methods, 3 blocks, lines 32-749. The bar is 400 significant lines; this is 60 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: LoroDoc crates/loro/src/lib.rs:122— ClassTooLong — 444 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 117 methods, 4 blocks, lines 122-2161. The bar is 400 significant lines; this is 44 over it, 1.11× 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 — 434 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-1475. The bar is 400 significant lines; this is 34 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InnerStore crates/loro-internal/src/state/container_store/inner_store.rs:29— ClassTooLong — 402 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, 4 blocks, lines 29-709. The bar is 400 significant lines; this is 2 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×20
loro_internal::dag::_find_meet_and_mode (cyclomatic 92) crates/loro-internal/src/dag.rs:740— 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::dag::_walk_to_meet (cyclomatic 40) crates/loro-internal/src/dag.rs:442— loro_internal::dag::_walk_to_meet 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.
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::diff::diff_impl::dj_diff (cyclomatic 30) crates/loro-internal/src/diff/diff_impl.rs:364— 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:968— 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:185— 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:113— 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:190— 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:225— 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:4165— 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:745— 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::version::try_shrink_frontiers (cyclomatic 17) crates/loro-internal/src/version.rs:1009— loro_internal::version::try_shrink_frontiers 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:803— 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:1403— 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.
Repeated repair: crates/loro-internal/src/undo.rs crates/loro-internal/src/undo.rs:189— crates/loro-internal/src/undo.rs changed 14 times in last 90 days and 13 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is loro_internal::undo::transform_cursor at line 189), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve grouped undo across split history spans (#1278)”; “fix: reset undo merge timer when a new item is created (#1276)”; “fix: enforce undo stack limit on resize and redo (#1272)”; “fix: transform selection delta when undoing the last item (#1102)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/undo.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-wasm/src/lib.rs crates/loro-wasm/src/lib.rs:6055— crates/loro-wasm/src/lib.rs changed 15 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is UndoManager::setOnPush at line 6055), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(wasm): keep onPush metadata at the undo limit (#1253)”; “fix: reject caller input that panicked or silently lost ops (#1258)”; “fix: preserve undo and redo history boundaries on no-ops (#1202)”; “fix: traverse deep trees without overflowing the stack (#1206)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-wasm/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:441— crates/loro-internal/src/oplog/pending_changes.rs changed 9 times in last 90 days and 8 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 PendingChangesRollback::rollback at line 441), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: replay pending changes after snapshot bootstrap (#1281)”; “fix: reject trimmed dependencies during shallow import (#1280)”; “fix: reject imports missing a causal peer predecessor (#1274)”; “fix: reject caller input that panicked or silently lost ops (#1258)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/encoding/fast_snapshot.rs crates/loro-internal/src/encoding/fast_snapshot.rs:172— crates/loro-internal/src/encoding/fast_snapshot.rs changed 8 times in last 90 days and 7 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 172), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject caller input that panicked or silently lost ops (#1258)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/arena.rs crates/loro-internal/src/arena.rs:702— crates/loro-internal/src/arena.rs changed 8 times in last 90 days and 7 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 702), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep untrusted deep nesting from aborting the process (#1249)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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.rs crates/loro-internal/src/encoding.rs:175— crates/loro-internal/src/encoding.rs changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is EncodeMode::from_i64 at line 175), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject trimmed dependencies during shallow import (#1280)”; “fix: reject caller input that panicked or silently lost ops (#1258)”; “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “fix: keep binary import exact when JSON drops value bits”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/oplog/change_store/block_encode.rs crates/loro-internal/src/oplog/change_store/block_encode.rs:610— crates/loro-internal/src/oplog/change_store/block_encode.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 15 (its worst body is loro_internal::oplog::change_store::block_encode::decode_block at line 610), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: bound change-header allocations during import (#1275)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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.rs crates/loro-internal/src/state/container_store.rs:398— crates/loro-internal/src/state/container_store.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is ContainerStore::check_eq_after_parsing at line 398), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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:760— crates/loro-internal/src/state/container_store/container_wrapper.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ContainerWrapper::decode_state at line 760), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: bound tree history parent walks and cover skipped cycle moves (#1273)”; “fix: take the tree checkout window from the two versions (#1152)”; “fix: pick shallow roots as critical versions of the retained history (#1104)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/container/richtext/tracker.rs crates/loro-internal/src/container/richtext/tracker.rs:393— crates/loro-internal/src/container/richtext/tracker.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 14 (its worst body is Tracker::_checkout at line 393), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: big text insert after a concurrent change imports in linear time (#1236)”; “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/container/richtext/tracker.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/map_state.rs crates/loro-internal/src/state/map_state.rs:240— crates/loro-internal/src/state/map_state.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 8 (its worst body is MapState::apply_diff_and_convert at line 240), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: keep untrusted deep nesting from aborting the process (#1249)”; “fix: prevent stack overflow when reading and dropping deep snapshot values (#1204)”; “fix: keep root-time map values when checking out a shallow doc (#1124)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/state/map_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.
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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/container/list/list_op.rs crates/loro-internal/src/container/list/list_op.rs:228— crates/loro-internal/src/container/list/list_op.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is DeleteSpanWithId::is_mergable at line 228), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: reject overflowing or inverted text mark ranges on import (#1287)”; “fix: keep parsed blocks out of doc-wide arenas and contain callback panics (#1197)”; “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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/container/list/list_op.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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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.
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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: crates/loro-internal/src/loro.rs crates/loro-internal/src/loro.rs:2592— crates/loro-internal/src/loro.rs changed 26 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 2592. 20 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/oplog.rs crates/loro-internal/src/oplog.rs:1269— crates/loro-internal/src/oplog.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in OpLog::try_iter_from_replay_base_causally_filtered at line 1269. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/state.rs crates/loro-internal/src/state.rs:664— crates/loro-internal/src/state.rs changed 16 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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:740— 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 740. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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 14 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. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/change_store.rs crates/loro-internal/src/oplog/change_store.rs:1554— crates/loro-internal/src/oplog/change_store.rs changed 11 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 1554. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/state/movable_list_state.rs crates/loro-internal/src/state/movable_list_state.rs:1092— crates/loro-internal/src/state/movable_list_state.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in MovableListState::apply_diff_and_convert at line 1092. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/state/movable_list_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/shallow_snapshot.rs crates/loro-internal/src/encoding/shallow_snapshot.rs:301— crates/loro-internal/src/encoding/shallow_snapshot.rs changed 10 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. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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: 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 5 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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: crates/loro-internal/src/oplog/known_history.rs crates/loro-internal/src/oplog/known_history.rs:43— crates/loro-internal/src/oplog/known_history.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in ImportedValues::eq at line 43. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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.
Hotspot: crates/loro-internal/src/version.rs crates/loro-internal/src/version.rs:1009— crates/loro-internal/src/version.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in loro_internal::version::try_shrink_frontiers at line 1009. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-internal/src/version.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/txn.rs crates/loro-internal/src/txn.rs:968— crates/loro-internal/src/txn.rs changed 5 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 968. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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/state/richtext_state.rs crates/loro-internal/src/state/richtext_state.rs:1403— 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 1403. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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: 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08: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-common/src/value.rs crates/loro-common/src/value.rs:46— crates/loro-common/src/value.rs changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in loro_common::value::values_eq at line 46. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 00:57:59 -08:00' --until='2026-11-13 00:57:59 -08:00' --full-history --no-merges -- crates/loro-common/src/value.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.
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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/generic-btree/src/lib.rs:2112` calls `take` and `crates/generic-btree/src/lib.rs:2089` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/style_range_map.rs:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/loro-internal/src/handler.rs:3322— crates/loro-internal/src/handler.rs:3322-3329 | crates/loro-internal/src/handler.rs:3892-3899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/loro-internal/src/handler.rs:3414— crates/loro-internal/src/handler.rs:3414-3421 | crates/loro-internal/src/handler.rs:4109-4116 — both copies are in the same file, so extract the 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:3756— crates/loro-internal/src/handler.rs:3756-3763 | crates/loro-internal/src/handler.rs:3951-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/loro-internal/src/handler.rs:3754` calls `ensure_no_regular_container_value` and `crates/loro-internal/src/handler.rs:3949` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) crates/loro-internal/src/handler.rs:4514— crates/loro-internal/src/handler.rs:4514-4521 | crates/loro-internal/src/handler.rs:4530-4537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:4514` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/loro-internal/src/state/container_store/container_wrapper.rs:344— crates/loro-internal/src/state/container_store/container_wrapper.rs:344-351 | crates/loro-internal/src/state/container_store/container_wrapper.rs:377-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/container_store/container_wrapper.rs:344` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/kv-store/src/block.rs:757— crates/kv-store/src/block.rs:757-764 | crates/kv-store/src/block.rs:781-788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/kv-store/src/block.rs:757` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/loro-internal/src/state/container_store/inner_store.rs:361— crates/loro-internal/src/state/container_store/inner_store.rs:361-368 | crates/loro-internal/src/state/container_store/inner_store.rs:388-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/container_store/inner_store.rs:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn try_get_parent_and_value_ephemeral( &mut` in one and `crate) fn try_get_parent_and_tree_meta_ids_ephemeral( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 2) crates/dev-utils/src/lib.rs:79— crates/dev-utils/src/lib.rs:79-86 | crates/dev-utils/src/lib.rs:91-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) crates/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:696— crates/loro-wasm/src/convert.rs:696-703 | crates/loro-wasm/src/convert.rs:720-727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/convert.rs:696` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/loro-internal/src/encoding/value.rs:646— crates/loro-internal/src/encoding/value.rs:646-653 | crates/loro-internal/src/encoding/value.rs:750-757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/value.rs:646` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/value_decode.rs:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/value.rs:202` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
FunctionTooLong: loro_internal::dag::_find_meet_and_mode crates/loro-internal/src/dag.rs:740— 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::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 205 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 105 over it, 2.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.
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::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:968— 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:610— 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:364— 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:89— FunctionTooLong — loro_internal::oplog::change_store::block_meta_encode::decode_changes_header runs 126 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 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: 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.
FunctionTooLong: loro_internal::dag::_walk_to_meet crates/loro-internal/src/dag.rs:442— FunctionTooLong — loro_internal::dag::_walk_to_meet runs 104 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 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×13
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/generic-btree/src/lib.rs:765` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/loro-internal/src/diff_calc.rs:1071— crates/loro-internal/src/diff_calc.rs:1071-1079 | crates/loro-internal/src/diff_calc.rs:1892-1900 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/diff_calc.rs:1071` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/shallow_snapshot.rs:1080` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) crates/loro-internal/src/handler.rs:2029— crates/loro-internal/src/handler.rs:2029-2037 | crates/loro-internal/src/handler.rs:2053-2061 — both copies are in the same file, so extract the 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:3281— crates/loro-internal/src/handler.rs:3281-3289 | crates/loro-internal/src/handler.rs:3373-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 (9 lines × 2) crates/loro-internal/src/state.rs:2548— crates/loro-internal/src/state.rs:2548-2556 | crates/loro-internal/src/state.rs:2614-2622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state.rs:2548` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/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:2163-2171 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/awareness.rs:220` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/kv-store/src/block.rs:848— crates/kv-store/src/block.rs:848-856 | crates/kv-store/src/sstable.rs:908-916 — 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:5062— crates/loro-internal/src/handler.rs:5062-5070 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/json_schema.rs:952` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
R4 · Test Coverage· No test reaches this file · ×13
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 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 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 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 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/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.
LoroDoc::check_apply_diff_creates_no_unknown_container (cognitive 122) crates/loro-internal/src/loro.rs:2592— 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:2182— 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:973— 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::order_mergeable_removals (cognitive 40) crates/loro-internal/src/loro.rs:2369— LoroDoc::order_mergeable_removals has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoroDoc::plan_full_state_batch (cognitive 33) crates/loro-internal/src/loro.rs:2472— 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::commit_internal_inner (cognitive 30) crates/loro-internal/src/loro.rs:397— LoroDoc::commit_internal_inner has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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::import_blobs_as_batch (cognitive 29) crates/loro-internal/src/loro.rs:3086— LoroDoc::import_blobs_as_batch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (8 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoroDoc::query_pos_internal (cognitive 28) crates/loro-internal/src/loro.rs:3698— 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 27) crates/loro-internal/src/loro.rs:1565— LoroDoc::undo_internal_with has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (20 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:888— 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:4250— 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.
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:2456— 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:2027— 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:1864— 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::diffs_to_event (cognitive 24) crates/loro-internal/src/state.rs:2118— DocState::diffs_to_event has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (3 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.
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:2233— 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:673` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/history_cache.rs:864` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) 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/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:571— crates/loro-wasm/src/convert.rs:571-575 | crates/loro-wasm/src/convert.rs:628-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/convert.rs:571` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/loro-internal/src/oplog/change_store/block_encode.rs:472— crates/loro-internal/src/oplog/change_store/block_encode.rs:472-476 | crates/loro-internal/src/oplog/change_store/block_encode.rs:477-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/loro-internal/src/oplog/change_store/block_encode.rs:482— crates/loro-internal/src/oplog/change_store/block_encode.rs:482-486 | crates/loro-internal/src/oplog/change_store/block_encode.rs:487-491 — both copies are in the same file, so extract the 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/style_range_map.rs:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/container_store/inner_store.rs:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn ensure_container( &mut` in one and `crate) fn get_mut(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D30 · Dependency Vulnerabilities· Medium CVE · ×10
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:530` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/loro-internal/src/loro.rs:3846— crates/loro-internal/src/loro.rs:3846-3858 | crates/loro-internal/src/loro.rs:3861-3873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/loro.rs:3846` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/loro-internal/src/oplog/change_store.rs:885— crates/loro-internal/src/oplog/change_store.rs:885-897 | crates/loro-internal/src/oplog/change_store.rs:917-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/oplog/change_store.rs:885` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/loro-internal/src/version.rs:859— crates/loro-internal/src/version.rs:859-871 | crates/loro-internal/src/version.rs:875-887 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/version.rs:859` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/loro-wasm/src/convert.rs:516— crates/loro-wasm/src/convert.rs:516-528 | crates/loro-wasm/src/convert.rs:602-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/convert.rs:516` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/loro-wasm/src/lib.rs:6064— crates/loro-wasm/src/lib.rs:6064-6076 | crates/loro-wasm/src/lib.rs:6192-6204 — both copies are in the same file, so extract the 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:680` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/one_doc_fuzzer.rs:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) 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.
Duplicated block (11 lines × 2) crates/kv-store/src/sstable.rs:935— crates/kv-store/src/sstable.rs:935-945 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) crates/loro-internal/src/container/richtext/tracker.rs:165— crates/loro-internal/src/container/richtext/tracker.rs:165-175 | crates/loro-internal/src/container/richtext/tracker.rs:365-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/tracker.rs:165` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `op_id` to `IdFull` in one and `ID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-internal/src/container/richtext/tracker.rs:376` calls `update_insert_by_split` and `crates/loro-internal/src/container/richtext/tracker.rs:176` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) crates/loro-internal/src/container/richtext/tracker.rs:410— crates/loro-internal/src/container/richtext/tracker.rs:410-420 | crates/loro-internal/src/container/richtext/tracker.rs:515-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/tracker.rs:410` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) crates/loro-internal/src/encoding/shallow_snapshot.rs:537— crates/loro-internal/src/encoding/shallow_snapshot.rs:537-547 | crates/loro-internal/src/encoding/shallow_snapshot.rs:841-851 — both copies are in the same file, so extract the 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:4667— crates/loro-internal/src/handler.rs:4667-4677 | crates/loro-internal/src/handler.rs:4703-4713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:4667` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/loro-internal/src/handler.rs:4705— crates/loro-internal/src/handler.rs:4705-4715 | crates/loro-internal/src/handler.rs:5044-5054 — both copies are in the same file, so extract the 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm-tools/src/main.rs:170` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/loro-wasm-tools/src/main.rs:237` calls `sort_by_key` and `crates/loro-wasm-tools/src/main.rs:168` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/value.rs:406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/loro-internal/src/diff_calc.rs:1048— crates/loro-internal/src/diff_calc.rs:1048-1053 | crates/loro-internal/src/diff_calc.rs:1877-1882 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/diff_calc.rs:1048` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:1144— crates/loro-internal/src/handler.rs:1144-1149 | crates/loro-internal/src/handler.rs:1361-1366 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:1144` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/loro-internal/src/handler.rs:1360` calls `Text`, `get_deep_value` and `crates/loro-internal/src/handler.rs:1143` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:3292— crates/loro-internal/src/handler.rs:3292-3297 | crates/loro-internal/src/handler.rs:3386-3391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/loro-internal/src/handler.rs:3764— crates/loro-internal/src/handler.rs:3764-3769 | crates/loro-internal/src/handler.rs:3963-3968 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3764` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler/tree.rs:409` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro/src/event.rs:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/loro-internal/src/diff/diff_impl.rs:208— crates/loro-internal/src/diff/diff_impl.rs:208-213 | crates/loro-internal/src/diff/diff_impl.rs:237-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/diff/diff_impl.rs:208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/loro-internal/src/oplog/change_store.rs:1231— crates/loro-internal/src/oplog/change_store.rs:1231-1236 | crates/loro-internal/src/oplog/change_store.rs:1266-1271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/delta/src/delta_rope/rle_tree.rs:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×9
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:635-644 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/loro-internal/src/handler.rs:3264— crates/loro-internal/src/handler.rs:3264-3273 | crates/loro-internal/src/handler.rs:3728-3737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3264` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/loro-wasm/src/lib.rs:4144— crates/loro-wasm/src/lib.rs:4144-4153 | crates/loro-wasm/src/lib.rs:4586-4595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) crates/loro-internal/src/container/richtext/style_range_map.rs:311— crates/loro-internal/src/container/richtext/style_range_map.rs:311-320 | crates/loro-internal/src/container/richtext/style_range_map.rs:342-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 (10 lines × 2) crates/loro-internal/src/state/richtext_state.rs:709— crates/loro-internal/src/state/richtext_state.rs:709-718 | crates/loro-internal/src/state/richtext_state.rs:735-744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/richtext_state.rs:709` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/container/tree.rs:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/fuzz/src/actor.rs:114— crates/fuzz/src/actor.rs:114-123 | crates/fuzz/src/actor.rs:131-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/fuzz/src/actor.rs:125` calls `attach` and `crates/fuzz/src/actor.rs:141` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
LoroDoc::check_apply_diff_creates_no_unknown_container (cyclomatic 48) crates/loro-internal/src/loro.rs:2592— 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:973— 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:2182— 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 23) crates/loro-internal/src/loro.rs:1565— LoroDoc::undo_internal_with has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LoroDoc::order_mergeable_removals (cyclomatic 21) crates/loro-internal/src/loro.rs:2369— LoroDoc::order_mergeable_removals 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.
LoroDoc::query_pos_internal (cyclomatic 20) crates/loro-internal/src/loro.rs:3698— 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::commit_internal_inner (cyclomatic 17) crates/loro-internal/src/loro.rs:397— LoroDoc::commit_internal_inner 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.
LoroDoc::import_blobs_as_batch (cyclomatic 16) crates/loro-internal/src/loro.rs:3086— LoroDoc::import_blobs_as_batch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×8
Edited copy of a member (9 corresponding lines) crates/dev-utils/src/lib.rs:78— crates/dev-utils/src/lib.rs:78-86 | crates/dev-utils/src/lib.rs:90-98 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:987— crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:987-995 | crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:997-1009 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/loro-internal/src/handler.rs:3321— crates/loro-internal/src/handler.rs:3321-3329 | crates/loro-internal/src/handler.rs:3891-3899 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/loro-internal/src/encoding/json_schema.rs:1528— crates/loro-internal/src/encoding/json_schema.rs:1528-1536 | crates/loro-internal/src/encoding/json_schema.rs:1556-1568 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/loro-common/src/value.rs:1047— crates/loro-common/src/value.rs:1047-1055 | crates/loro-common/src/value.rs:1060-1069 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/loro-wasm/src/lib.rs:2406— crates/loro-wasm/src/lib.rs:2406-2414 | crates/loro-wasm/src/lib.rs:3636-3644 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/kv-store/src/sstable.rs:582— crates/kv-store/src/sstable.rs:582-590 | crates/kv-store/src/sstable.rs:593-607 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/kv-store/src/block.rs:860— crates/kv-store/src/block.rs:860-868 | crates/kv-store/src/sstable.rs:920-928 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×8
Edited copy of a member (7 corresponding lines) crates/loro-internal/src/version.rs:306— crates/loro-internal/src/version.rs:306-312 | crates/loro-internal/src/version.rs:318-326 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/loro-internal/src/utils/string_slice.rs:251— crates/loro-internal/src/utils/string_slice.rs:251-257 | crates/loro-internal/src/utils/string_slice.rs:259-271 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/kv-store/src/utils.rs:3— crates/kv-store/src/utils.rs:3-9 | crates/kv-store/src/utils.rs:18-24 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/loro-internal/src/container/richtext/fugue_span.rs:137— crates/loro-internal/src/container/richtext/fugue_span.rs:137-143 | crates/loro-internal/src/container/richtext/fugue_span.rs:145-151 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/generic-btree/src/generic_impl/ord.rs:298— crates/generic-btree/src/generic_impl/ord.rs:298-304 | crates/loro-internal/src/state/tree_state.rs:601-607 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/loro-common/src/value.rs:633— crates/loro-common/src/value.rs:633-640 | crates/loro-internal/src/version.rs:1179-1185 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/loro-internal/src/encoding/outdated_encode_reordered.rs:98— crates/loro-internal/src/encoding/outdated_encode_reordered.rs:98-104 | crates/loro-internal/src/op/content.rs:91-97 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/loro-internal/src/handler.rs:3078— crates/loro-internal/src/handler.rs:3078-3084 | crates/loro-internal/src/handler/full_state.rs:108-114 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
RichtextState::apply_diff (cognitive 127) crates/loro-internal/src/state/richtext_state.rs:627— 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:391— 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:227— 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.
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.
ChangeStore::get_change_by_lamport_lte (cognitive 53) crates/loro-internal/src/oplog/change_store.rs:1554— 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:872— 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:412— 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:1002— 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:1475— 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:2009— 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:1313— 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×7
Edited copy of a member (11 corresponding lines) crates/loro-wasm/src/container_tree.rs:266— crates/loro-wasm/src/container_tree.rs:266-276 | crates/loro-wasm/src/container_tree.rs:286-296 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/loro-internal/src/encoding/value.rs:1135— crates/loro-internal/src/encoding/value.rs:1135-1145 | crates/loro-internal/src/encoding/value.rs:1151-1163 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/loro-internal/src/handler/tree.rs:57— crates/loro-internal/src/handler/tree.rs:57-68 | crates/loro-internal/src/handler/tree.rs:70-80 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/loro-internal/src/handler.rs:1646— crates/loro-internal/src/handler.rs:1646-1656 | crates/loro-internal/src/handler.rs:1765-1775 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:447— crates/loro-internal/src/jsonpath/jsonpath_impl.rs:447-457 | crates/loro-internal/src/jsonpath/jsonpath_impl.rs:460-471 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/loro-internal/src/handler/tree.rs:1082— crates/loro-internal/src/handler/tree.rs:1082-1092 | crates/loro-internal/src/handler/tree.rs:1120-1131 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/fuzz/src/container/tree.rs:482— crates/fuzz/src/container/tree.rs:482-492 | crates/fuzz/src/container/tree.rs:494-504 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/json_schema.rs:839` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15 lines × 2) crates/loro-internal/src/jsonpath/parser.rs:332— crates/loro-internal/src/jsonpath/parser.rs:332-346 | crates/loro-internal/src/jsonpath/parser.rs:403-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/jsonpath/parser.rs:332` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/loro-internal/src/state/movable_list_state.rs:1274— crates/loro-internal/src/state/movable_list_state.rs:1274-1288 | crates/loro-internal/src/state/movable_list_state.rs:1324-1338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/movable_list_state.rs:1274` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/loro-internal/src/version.rs:780— crates/loro-internal/src/version.rs:780-794 | crates/loro-internal/src/version.rs:841-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/version.rs:780` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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.
Duplicated block (12 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:310— crates/loro-internal/src/encoding/json_schema.rs:310-321 | crates/loro-internal/src/encoding/json_schema.rs:341-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/json_schema.rs:310` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/loro-internal/src/encoding/json_schema.rs:376— crates/loro-internal/src/encoding/json_schema.rs:376-387 | crates/loro-internal/src/encoding/json_schema.rs:436-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) crates/loro-internal/src/handler.rs:3542— crates/loro-internal/src/handler.rs:3542-3553 | crates/loro-internal/src/handler.rs:4258-4269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/loro-internal/src/jsonpath/parser.rs:307— crates/loro-internal/src/jsonpath/parser.rs:307-318 | crates/loro-internal/src/jsonpath/parser.rs:433-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/jsonpath/parser.rs:307` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/loro-internal/src/handler.rs:3400— crates/loro-internal/src/handler.rs:3400-3411 | crates/loro-internal/src/handler.rs:4094-4105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/loro-wasm/src/awareness.rs:241— crates/loro-wasm/src/awareness.rs:241-252 | crates/loro-wasm/src/awareness.rs:261-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/awareness.rs:241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/fuzz/src/one_doc_fuzzer.rs:664— crates/fuzz/src/one_doc_fuzzer.rs:664-675 | crates/fuzz/src/one_doc_fuzzer.rs:681-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/one_doc_fuzzer.rs:681` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/loro-internal/src/oplog/change_store/block_encode.rs:328— crates/loro-internal/src/oplog/change_store/block_encode.rs:328-334 | crates/loro-internal/src/oplog/change_store/block_encode.rs:340-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/oplog/change_store/block_encode.rs:328` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) 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:819-825 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state.rs:76` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/loro-internal/src/value.rs:92— crates/loro-internal/src/value.rs:92-98 | crates/loro-internal/src/value.rs:174-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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:5465-5471 — 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:5656-5662 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/container/counter.rs:44` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
OpLog::check_changes_include_predecessors (cognitive 50) crates/loro-internal/src/oplog/known_history.rs:265— OpLog::check_changes_include_predecessors has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 11, loops 4 (10 pts), match/switch 1 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpLog::try_iter_from_replay_base_causally_filtered (cognitive 47) crates/loro-internal/src/oplog.rs:1269— OpLog::try_iter_from_replay_base_causally_filtered has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (35 pts), match/switch 4 (7 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpLog::uncovered_entry_parents (cognitive 28) crates/loro-internal/src/oplog.rs:951— 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:519— 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:594— 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.
OpLog::insert_new_change (cognitive 20) crates/loro-internal/src/oplog.rs:323— OpLog::insert_new_change has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×6
Edited copy of a member (19 corresponding lines) crates/loro-internal/src/event.rs:456— crates/loro-internal/src/event.rs:456-474 | crates/loro-internal/src/event.rs:505-528 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/loro-internal/src/state/container_store/inner_store.rs:357— crates/loro-internal/src/state/container_store/inner_store.rs:357-376 | crates/loro-internal/src/state/container_store/inner_store.rs:384-402 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/generic-btree/src/generic_impl/ord.rs:273— crates/generic-btree/src/generic_impl/ord.rs:273-291 | crates/loro-internal/src/state/tree_state.rs:575-594 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/loro-internal/src/jsonpath/parser.rs:214— crates/loro-internal/src/jsonpath/parser.rs:214-232 | crates/loro-internal/src/jsonpath/parser.rs:238-256 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/loro-internal/src/container/list/list_op.rs:475— crates/loro-internal/src/container/list/list_op.rs:475-493 | crates/loro-internal/src/container/list/list_op.rs:498-519 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/fuzz/src/crdt_fuzzer.rs:678— crates/fuzz/src/crdt_fuzzer.rs:678-701 | crates/fuzz/src/one_doc_fuzzer.rs:938-956 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×6
Edited copy of a member (12 corresponding lines) crates/loro/src/lib.rs:4245— crates/loro/src/lib.rs:4245-4256 | crates/loro/src/lib.rs:4354-4365 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/loro-internal/src/handler.rs:1138— crates/loro-internal/src/handler.rs:1138-1149 | crates/loro-internal/src/handler.rs:1355-1366 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/loro-internal/src/handler/tree.rs:969— crates/loro-internal/src/handler/tree.rs:969-980 | crates/loro-internal/src/handler/tree.rs:1156-1167 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/loro-internal/src/oplog.rs:528— crates/loro-internal/src/oplog.rs:528-541 | crates/loro-internal/src/oplog.rs:547-558 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/loro-internal/src/delta/map_delta.rs:76— crates/loro-internal/src/delta/map_delta.rs:76-87 | crates/loro-internal/src/delta/map_delta.rs:104-117 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/loro-common/src/lib.rs:844— crates/loro-common/src/lib.rs:844-855 | crates/loro-common/src/lib.rs:886-897 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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.
FixmeComment crates/loro-internal/src/loro.rs:1845— // 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/state/container_store/container_wrapper.rs:811— // 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.
AppDag::try_ensure_vv_for (cognitive 65) crates/loro-internal/src/oplog/loro_dag.rs:1161— 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::debug_vv_from_block_headers (cognitive 50) crates/loro-internal/src/oplog/loro_dag.rs:1446— AppDag::debug_vv_from_block_headers has cognitive complexity 50 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 7 (11 pts), boolean chains 2, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppDag::try_does_id_cover (cognitive 37) crates/loro-internal/src/oplog/loro_dag.rs:1316— AppDag::try_does_id_cover has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppDag::lazy_load_nodes_internal (cognitive 28) crates/loro-internal/src/oplog/loro_dag.rs:457— 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:659— 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.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×5
Edited copy of a member (14 corresponding lines) crates/loro-internal/src/op.rs:256— crates/loro-internal/src/op.rs:256-269 | crates/loro-internal/src/op.rs:271-286 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/loro-internal/src/state/container_store/inner_store.rs:297— crates/loro-internal/src/state/container_store/inner_store.rs:297-310 | crates/loro-internal/src/state/container_store/inner_store.rs:332-345 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/loro-internal/src/handler.rs:4766— crates/loro-internal/src/handler.rs:4766-4780 | crates/loro-internal/src/handler.rs:4783-4796 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/loro-internal/src/handler.rs:4410— crates/loro-internal/src/handler.rs:4410-4424 | crates/loro-internal/src/handler.rs:4454-4467 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/fuzz/src/actor.rs:113— crates/fuzz/src/actor.rs:113-128 | crates/fuzz/src/actor.rs:130-143 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×5
Edited copy of a member (10 corresponding lines) crates/loro-common/src/span.rs:214— crates/loro-common/src/span.rs:214-223 | crates/loro-internal/src/container/list/list_op.rs:420-429 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/loro-internal/src/jsonpath/parser.rs:267— crates/loro-internal/src/jsonpath/parser.rs:267-277 | crates/loro-internal/src/jsonpath/parser.rs:374-383 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/loro-internal/src/handler.rs:5115— crates/loro-internal/src/handler.rs:5115-5124 | crates/loro-internal/src/handler.rs:5126-5135 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/loro-internal/src/txn.rs:119— crates/loro-internal/src/txn.rs:119-128 | crates/loro-internal/src/txn.rs:132-141 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/loro-internal/src/container/richtext/richtext_state.rs:1183— crates/loro-internal/src/container/richtext/richtext_state.rs:1183-1192 | crates/loro-internal/src/state/list_state.rs:101-110 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:737` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) crates/loro-internal/src/jsonpath/parser.rs:320— crates/loro-internal/src/jsonpath/parser.rs:320-330 | crates/loro-internal/src/jsonpath/parser.rs:391-401 | crates/loro-internal/src/jsonpath/parser.rs:446-456 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 3) crates/loro-internal/src/jsonpath/parser.rs:332— crates/loro-internal/src/jsonpath/parser.rs:332-342 | crates/loro-internal/src/jsonpath/parser.rs:403-413 | crates/loro-internal/src/jsonpath/parser.rs:458-468 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-internal/src/jsonpath/parser.rs:469` calls `parse_logical_or_expression` and `crates/loro-internal/src/jsonpath/parser.rs:343` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:259` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2 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.
RichtextState::apply_diff (cyclomatic 40) crates/loro-internal/src/state/richtext_state.rs:627— 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:391— 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.
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:2456— 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:2027— 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.
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:792— 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.
RichtextDiffCalculator::apply_crdt_op_to_tracker (cognitive 43) crates/loro-internal/src/diff_calc.rs:1276— 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::calculate_diff (cognitive 34) crates/loro-internal/src/diff_calc.rs:1829— RichtextDiffCalculator::calculate_diff has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (11 pts), match/switch 4 (7 pts), boolean chains 5 (nesting depth added 16). Of this number, 18 points are the body's own statements and 16 belong to 2 function items inside it that branch. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
RichtextDiffCalculator::seed_tracker_from_shallow_root (cognitive 33) crates/loro-internal/src/diff_calc.rs:1451— 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::apply_change (cognitive 20) crates/loro-internal/src/diff_calc.rs:1724— 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×4
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/encoding/shallow_snapshot.rs:72— crates/loro-internal/src/encoding/shallow_snapshot.rs:72-112 | crates/loro-internal/src/oplog/change_store.rs:385-410 | crates/loro-internal/src/oplog/change_store.rs:412-469 | crates/loro-internal/src/oplog/change_store.rs:1228-1256 — 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:142— crates/loro-internal/src/state/richtext_state.rs:142-160 | crates/loro-internal/src/state/richtext_state.rs:199-225 | crates/loro-internal/src/state/richtext_state.rs:227-276 | crates/loro-internal/src/state/richtext_state.rs:1523-1599 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×4
Edited copy of a member (16 corresponding lines) crates/loro-internal/src/handler/text_update.rs:145— crates/loro-internal/src/handler/text_update.rs:145-161 | crates/loro-internal/src/handler/text_update.rs:163-178 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/loro-internal/src/state/map_state.rs:120— crates/loro-internal/src/state/map_state.rs:120-138 | crates/loro-internal/src/state/map_state.rs:202-217 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/loro-internal/src/handler/tree.rs:663— crates/loro-internal/src/handler/tree.rs:663-679 | crates/loro-internal/src/handler/tree.rs:681-696 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/loro-internal/src/container/richtext/richtext_state.rs:1310— crates/loro-internal/src/container/richtext/richtext_state.rs:1310-1325 | crates/loro-internal/src/container/richtext/richtext_state.rs:1390-1405 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×4
Edited copy of a member (17 corresponding lines) crates/loro-internal/src/undo.rs:46— crates/loro-internal/src/undo.rs:46-62 | crates/loro-internal/src/undo.rs:67-88 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/loro-internal/src/delta/seq.rs:260— crates/loro-internal/src/delta/seq.rs:260-277 | crates/loro-internal/src/delta/seq.rs:279-295 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/loro-internal/src/handler.rs:3144— crates/loro-internal/src/handler.rs:3144-3160 | crates/loro-internal/src/handler.rs:3162-3182 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/fuzz/src/actor.rs:145— crates/fuzz/src/actor.rs:145-162 | crates/fuzz/src/actor.rs:164-180 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×4
Edited copy of a member (6 corresponding lines) crates/loro-wasm/src/lib.rs:549— crates/loro-wasm/src/lib.rs:549-554 | crates/loro-wasm/src/lib.rs:556-561 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:821— crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:821-826 | crates/loro-internal/src/state/movable_list_state.rs:183-188 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/loro-internal/src/jsonpath/jsonpath_impl.rs:483— crates/loro-internal/src/jsonpath/jsonpath_impl.rs:483-488 | crates/loro-internal/src/value.rs:514-519 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/loro-internal/src/subscription.rs:38— crates/loro-internal/src/subscription.rs:38-43 | crates/loro-internal/src/utils/subscription.rs:683-688 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (21 lines × 2) crates/loro-wasm/src/convert.rs:67— crates/loro-wasm/src/convert.rs:67-87 | crates/loro-wasm/src/convert.rs:332-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 (21 lines × 2) crates/loro-wasm/src/lib.rs:3049— crates/loro-wasm/src/lib.rs:3049-3069 | crates/loro-wasm/src/lib.rs:3079-3099 — both copies are in the same file, so extract the 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:121` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:1106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:611— crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:611-626 | crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:669-684 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:611` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/loro-internal/src/handler.rs:3346— crates/loro-internal/src/handler.rs:3346-3361 | crates/loro-internal/src/handler.rs:3916-3931 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/loro-internal/src/state/tree_state.rs:1866— crates/loro-internal/src/state/tree_state.rs:1866-1881 | crates/loro-internal/src/state/tree_state.rs:1883-1898 — both copies are in the same file, so extract the 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:343` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) crates/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/oplog/loro_dag.rs:1588— crates/loro-internal/src/oplog/loro_dag.rs:1588-1601 | crates/loro-internal/src/oplog/loro_dag.rs:1641-1654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/oplog/loro_dag.rs:1588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/tree_state.rs:1324` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/actor.rs:149` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/fuzz/src/actor.rs:148` calls `attach` and `crates/fuzz/src/actor.rs:166` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
AppDag::debug_vv_from_block_headers (cyclomatic 26) crates/loro-internal/src/oplog/loro_dag.rs:1446— AppDag::debug_vv_from_block_headers 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.
AppDag::try_does_id_cover (cyclomatic 21) crates/loro-internal/src/oplog/loro_dag.rs:1316— AppDag::try_does_id_cover 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.
AppDag::try_ensure_vv_for (cyclomatic 16) crates/loro-internal/src/oplog/loro_dag.rs:1161— 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.
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.
RichtextDiffCalculator::calculate_diff (cyclomatic 22) crates/loro-internal/src/diff_calc.rs:1829— RichtextDiffCalculator::calculate_diff has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
RichtextDiffCalculator::apply_crdt_op_to_tracker (cyclomatic 18) crates/loro-internal/src/diff_calc.rs:1276— 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:1451— 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.
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.
UndoManager::setOnPush (cognitive 41) crates/loro-wasm/src/lib.rs:6055— UndoManager::setOnPush has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 4 (9 pts), loops 1 (6 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UndoManager::new (cognitive 29) crates/loro-internal/src/undo.rs:748— UndoManager::new has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UndoManager::perform (cognitive 21) crates/loro-internal/src/undo.rs:937— 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.
TextHandler::insert_with_txn_and_attr (cognitive 40) crates/loro-internal/src/handler.rs:2148— 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:2984— 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:2692— 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.
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.
loro_wasm::convert::js_value_to_loro_value (cognitive 27) crates/loro-wasm/src/convert.rs:661— 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:601— 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:277— 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.
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· Edited copy of a member (26 corresponding lines) · ×3
Edited copy of a member (26 corresponding lines) crates/loro-common/src/value.rs:1136— crates/loro-common/src/value.rs:1136-1161 | crates/loro-internal/src/awareness.rs:498-527 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/delta/src/delta_rope/rle_tree.rs:168— crates/delta/src/delta_rope/rle_tree.rs:168-193 | crates/generic-btree/src/generic_impl/len_finder.rs:56-81 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/loro-internal/src/encoding/json_schema.rs:727— crates/loro-internal/src/encoding/json_schema.rs:727-752 | crates/loro-internal/src/handler.rs:43-82 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×3
Edited copy of a member (25 corresponding lines) crates/loro-wasm/src/lib.rs:2253— crates/loro-wasm/src/lib.rs:2253-2277 | crates/loro-wasm/src/lib.rs:2285-2313 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/loro-wasm/src/lib.rs:3048— crates/loro-wasm/src/lib.rs:3048-3072 | crates/loro-wasm/src/lib.rs:3078-3102 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/generic-btree/src/lib.rs:1630— crates/generic-btree/src/lib.rs:1630-1654 | crates/generic-btree/src/lib.rs:1656-1682 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×3
Edited copy of a member (23 corresponding lines) crates/kv-store/src/block.rs:751— crates/kv-store/src/block.rs:751-773 | crates/kv-store/src/block.rs:775-797 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/bench-utils/src/lib.rs:208— crates/bench-utils/src/lib.rs:208-230 | crates/bench-utils/src/lib.rs:236-267 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/loro-internal/src/diff_calc/tree.rs:497— crates/loro-internal/src/diff_calc/tree.rs:497-519 | crates/loro-internal/src/state/tree_state.rs:739-761 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×3
Edited copy of a member (30 corresponding lines) crates/rle/src/rle_vec.rs:289— crates/rle/src/rle_vec.rs:289-318 | crates/rle/src/rle_vec.rs:380-413 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/loro-internal/src/container/richtext/style_range_map.rs:191— crates/loro-internal/src/container/richtext/style_range_map.rs:191-220 | crates/loro-internal/src/container/richtext/style_range_map.rs:233-262 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/loro-internal/src/state/list_state.rs:300— crates/loro-internal/src/state/list_state.rs:300-341 | crates/loro-internal/src/state/list_state.rs:343-372 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×3
Edited copy of a member (21 corresponding lines) crates/loro-internal/src/handler.rs:3252— crates/loro-internal/src/handler.rs:3252-3273 | crates/loro-internal/src/handler.rs:3975-3995 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/loro-internal/src/utils/string_slice.rs:160— crates/loro-internal/src/utils/string_slice.rs:160-184 | crates/loro-internal/src/utils/string_slice.rs:294-314 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/loro-internal/src/version/frontiers.rs:148— crates/loro-internal/src/version/frontiers.rs:148-168 | crates/loro-internal/src/version/frontiers.rs:170-191 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×3
Edited copy of a member (22 corresponding lines) crates/loro-internal/src/handler.rs:3558— crates/loro-internal/src/handler.rs:3558-3579 | crates/loro-internal/src/handler.rs:4274-4296 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:605— crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:605-626 | crates/loro-internal/src/container/richtext/tracker/crdt_rope.rs:663-684 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/loro-internal/src/container/richtext/richtext_state.rs:1030— crates/loro-internal/src/container/richtext/richtext_state.rs:1030-1051 | crates/loro-internal/src/container/richtext/richtext_state.rs:1053-1080 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×3
Edited copy of a member (13 corresponding lines) crates/loro-internal/src/handler.rs:672— crates/loro-internal/src/handler.rs:672-684 | crates/loro-internal/src/handler.rs:686-698 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs:84— crates/loro-internal/src/state/container_store/container_wrapper.rs:84-98 | crates/loro-internal/src/state/container_store/container_wrapper.rs:100-112 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/loro-internal/src/state/list_state.rs:486— crates/loro-internal/src/state/list_state.rs:486-498 | crates/loro-internal/src/state/list_state.rs:500-512 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×3
Edited copies of one member (3 members, 12+ corresponding lines) crates/loro-wasm/src/awareness.rs:217— crates/loro-wasm/src/awareness.rs:217-228 | crates/loro-wasm/src/lib.rs:2160-2171 | crates/loro-wasm/src/lib.rs:2661-2674 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) crates/loro-internal/src/handler/tree.rs:902— crates/loro-internal/src/handler/tree.rs:902-913 | crates/loro-internal/src/handler/tree.rs:915-926 | crates/loro-internal/src/handler/tree.rs:955-966 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) crates/loro-internal/src/handler.rs:3303— crates/loro-internal/src/handler.rs:3303-3314 | crates/loro-internal/src/handler.rs:4513-4526 | crates/loro-internal/src/handler.rs:4588-4601 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×3
Edited copy of a member (8 corresponding lines) crates/loro-internal/src/handler.rs:3531— crates/loro-internal/src/handler.rs:3531-3538 | crates/loro-internal/src/handler.rs:4244-4254 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/loro-wasm/src/awareness.rs:103— crates/loro-wasm/src/awareness.rs:103-111 | crates/loro-wasm/src/awareness.rs:207-214 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/loro-internal/src/state/movable_list_state.rs:1426— crates/loro-internal/src/state/movable_list_state.rs:1426-1438 | crates/loro-internal/src/state/list_state.rs:696-703 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×3
Edited copies of one member (3 members, 9+ corresponding lines) crates/loro-internal/src/handler.rs:2899— crates/loro-internal/src/handler.rs:2899-2911 | crates/loro-internal/src/handler/tree.rs:982-990 | crates/loro-internal/src/handler/tree.rs:1052-1065 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) crates/loro-internal/src/encoding/value.rs:898— crates/loro-internal/src/encoding/value.rs:898-908 | crates/loro-internal/src/encoding/value.rs:911-919 | crates/loro-internal/src/encoding/value.rs:931-940 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) crates/fuzz/src/container/list.rs:61— crates/fuzz/src/container/list.rs:61-69 | crates/fuzz/src/container/map.rs:52-60 | crates/fuzz/src/container/movable_list.rs:59-67 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/json_schema.rs:734` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:323` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:386` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12–13 lines × 2) crates/loro-internal/src/handler.rs:4544— crates/loro-internal/src/handler.rs:4544-4555 | crates/loro-internal/src/handler.rs:4574-4586 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:4574` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 2) crates/loro-internal/src/oplog/change_store.rs:284— crates/loro-internal/src/oplog/change_store.rs:284-295 | crates/loro-internal/src/oplog/change_store.rs:2415-2427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/oplog/change_store.rs:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/container/tree.rs:232` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
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:977— 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.
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.
TextHandler::insert_with_txn_and_attr (cyclomatic 27) crates/loro-internal/src/handler.rs:2148— 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:2984— 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.
OpLog::check_changes_include_predecessors (cyclomatic 27) crates/loro-internal/src/oplog/known_history.rs:265— OpLog::check_changes_include_predecessors 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.
OpLog::try_iter_from_replay_base_causally_filtered (cyclomatic 26) crates/loro-internal/src/oplog.rs:1269— OpLog::try_iter_from_replay_base_causally_filtered 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::get_change_by_lamport_lte (cyclomatic 26) crates/loro-internal/src/oplog/change_store.rs:1554— 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:872— 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.
MovableListDiffCalculator::calculate_diff (cyclomatic 21) crates/loro-internal/src/diff_calc.rs:2205— MovableListDiffCalculator::calculate_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.
MovableListDiffCalculator::apply_change (cyclomatic 16) crates/loro-internal/src/diff_calc.rs:2100— 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.
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.
MovableListState::apply_diff_and_convert (cognitive 97) crates/loro-internal/src/state/movable_list_state.rs:1092— 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:1626— 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.
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:421— 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.
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.
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.
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.
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.
MovableListDiffCalculator::calculate_diff (cognitive 32) crates/loro-internal/src/diff_calc.rs:2205— MovableListDiffCalculator::calculate_diff has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 6, loops 2 (4 pts), 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:2100— 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.
Tracker::_checkout (cognitive 28) crates/loro-internal/src/container/richtext/tracker.rs:393— 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:507— 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.
ListDiffCalculator::calculate_diff::handle_unknown (cognitive 26) crates/loro-internal/src/diff_calc.rs:1038— 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 23) crates/loro-internal/src/diff_calc.rs:945— ListDiffCalculator::calculate_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (13 pts), match/switch 3 (8 pts), boolean chains 6 (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.
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.
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· Edited copy of a member (31 corresponding lines) · ×2
Edited copy of a member (31 corresponding lines) crates/generic-btree/src/lib.rs:2344— crates/generic-btree/src/lib.rs:2344-2374 | crates/generic-btree/src/lib.rs:2376-2407 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) crates/loro-internal/src/handler.rs:383— crates/loro-internal/src/handler.rs:383-418 | crates/loro-internal/src/handler.rs:1269-1299 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×2
Edited copy of a member (34 corresponding lines) crates/loro-internal/src/value.rs:79— crates/loro-internal/src/value.rs:79-112 | crates/loro-internal/src/value.rs:159-192 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) crates/loro-internal/src/delta/seq.rs:165— crates/loro-internal/src/delta/seq.rs:165-199 | crates/loro-internal/src/delta/seq.rs:201-234 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs:336— crates/loro-internal/src/state/container_store/container_wrapper.rs:336-364 | crates/loro-internal/src/state/container_store/container_wrapper.rs:370-402 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/kv-store/src/block.rs:621— crates/kv-store/src/block.rs:621-649 | crates/kv-store/src/block.rs:652-681 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×2
Edited copy of a member (24 corresponding lines) crates/loro-internal/src/state/map_state.rs:94— crates/loro-internal/src/state/map_state.rs:94-118 | crates/loro-internal/src/state/map_state.rs:177-200 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/delta/src/utf16.rs:20— crates/delta/src/utf16.rs:20-43 | crates/delta/src/utf16.rs:46-69 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×2
Edited copy of a member (20 corresponding lines) crates/loro-internal/src/handler.rs:3342— crates/loro-internal/src/handler.rs:3342-3361 | crates/loro-internal/src/handler.rs:3912-3931 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/loro-internal/src/handler/tree.rs:776— crates/loro-internal/src/handler/tree.rs:776-795 | crates/loro-internal/src/handler/tree.rs:807-829 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×2
Edited copy of a member (18 corresponding lines) crates/loro-internal/src/handler/tree.rs:401— crates/loro-internal/src/handler/tree.rs:401-418 | crates/loro-internal/src/handler/tree.rs:420-444 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/loro-internal/src/version.rs:735— crates/loro-internal/src/version.rs:735-756 | crates/loro-internal/src/version.rs:889-906 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×2
Edited copy of a member (15 corresponding lines) crates/loro-internal/src/loro.rs:584— crates/loro-internal/src/loro.rs:584-598 | crates/loro-internal/src/loro.rs:604-619 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/loro-common/src/lib.rs:335— crates/loro-common/src/lib.rs:335-355 | crates/loro-common/src/lib.rs:364-378 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×2
Edited copies of one member (4 members, 12+ corresponding lines) crates/loro/src/lib.rs:4215— crates/loro/src/lib.rs:4215-4226 | crates/loro/src/lib.rs:4258-4269 | crates/loro/src/lib.rs:4291-4302 | crates/loro/src/lib.rs:4303-4314 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) crates/loro-internal/src/handler/tree.rs:856— crates/loro-internal/src/handler/tree.rs:856-867 | crates/loro-internal/src/handler/tree.rs:929-940 | crates/loro-internal/src/handler/tree.rs:942-953 | crates/loro-internal/src/handler/tree.rs:1039-1050 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×2
Edited copies of one member (3 members, 16+ corresponding lines) crates/loro-internal/src/utils/query_by_len.rs:73— crates/loro-internal/src/utils/query_by_len.rs:73-91 | crates/loro-internal/src/utils/query_by_len.rs:117-132 | crates/loro-internal/src/utils/query_by_len.rs:159-177 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) crates/kv-store/src/block.rs:483— crates/kv-store/src/block.rs:483-498 | crates/kv-store/src/block.rs:500-515 | crates/kv-store/src/block.rs:517-532 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) crates/loro-internal/src/handler.rs:1668— crates/loro-internal/src/handler.rs:1668-1678 | crates/loro-internal/src/handler.rs:1680-1690 | crates/loro-internal/src/handler.rs:1692-1702 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) crates/loro-internal/src/state/container_store.rs:344— crates/loro-internal/src/state/container_store.rs:344-355 | crates/loro-internal/src/state/container_store.rs:357-367 | crates/loro-internal/src/state/container_store.rs:369-380 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (40 lines × 2) crates/loro-internal/src/handler.rs:3446— crates/loro-internal/src/handler.rs:3446-3485 | crates/loro-internal/src/handler.rs:4156-4195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (40 lines × 2) crates/loro-internal/src/version.rs:407— crates/loro-internal/src/version.rs:407-446 | crates/loro-internal/src/version.rs:451-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/rle/src/rle_vec.rs:301` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:720` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 3) crates/loro-wasm/src/lib.rs:2221— crates/loro-wasm/src/lib.rs:2221-2234 | crates/loro-wasm/src/lib.rs:2262-2275 | crates/loro-wasm/src/lib.rs:2298-2311 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-wasm/src/lib.rs:2221` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) crates/loro-internal/src/loro.rs:4264— crates/loro-internal/src/loro.rs:4264-4275 | crates/loro-internal/src/oplog/loro_dag.rs:847-857 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/loro.rs:4264` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-wasm-tools/src/main.rs:237` calls `sort_by_key` and `crates/loro-wasm-tools/src/main.rs:170` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) crates/loro-internal/src/handler.rs:3343— crates/loro-internal/src/handler.rs:3343-3352 | crates/loro-internal/src/handler.rs:3718-3727 | crates/loro-internal/src/handler.rs:3913-3922 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3343` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/one_doc_fuzzer.rs:217` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/fuzz/src/crdt_fuzzer.rs:1024— crates/fuzz/src/crdt_fuzzer.rs:1024-1032 | 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 6 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:1024` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/fuzz/src/crdt_fuzzer.rs:1033` calls `unwrap` and `crates/loro-internal/src/fuzz.rs:58` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) crates/loro-internal/src/handler.rs:3688— crates/loro-internal/src/handler.rs:3688-3696 | crates/loro-internal/src/handler.rs:4383-4391 | crates/loro-internal/src/handler.rs:4993-5001 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8–9 lines × 2) crates/loro-internal/src/loro.rs:917— crates/loro-internal/src/loro.rs:917-925 | crates/loro-internal/src/loro.rs:1146-1153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/loro.rs:917` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/container/tree.rs:391` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 6) crates/fuzz/src/crdt_fuzzer.rs:975— crates/fuzz/src/crdt_fuzzer.rs:975-982 | crates/fuzz/src/crdt_fuzzer.rs:1023-1030 | 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 6 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 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.
Duplicated block (8 lines × 3) crates/loro-internal/src/encoding/shallow_snapshot.rs:509— crates/loro-internal/src/encoding/shallow_snapshot.rs:509-516 | crates/loro-internal/src/encoding/shallow_snapshot.rs:540-547 | crates/loro-internal/src/encoding/shallow_snapshot.rs:844-851 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-internal/src/encoding/shallow_snapshot.rs:548` calls `_checkout_without_emitting`, `map_err` and `crates/loro-internal/src/encoding/shallow_snapshot.rs:518` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) crates/loro-internal/src/encoding/fast_snapshot.rs:73— crates/loro-internal/src/encoding/fast_snapshot.rs:73-80 | crates/loro-internal/src/encoding/fast_snapshot.rs:82-89 | crates/loro-internal/src/encoding/fast_snapshot.rs:96-103 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 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:5244-5249 | 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:2950— crates/loro-internal/src/handler.rs:2950-2955 | crates/loro-internal/src/handler.rs:3680-3685 | crates/loro-internal/src/handler.rs:4375-4380 | crates/loro-internal/src/handler.rs:4985-4990 | crates/loro-internal/src/handler.rs:5147-5152 | 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-internal/src/handler.rs:2957` calls `push_str`, `insert_utf8`, `len_utf8` and `crates/loro-internal/src/handler.rs:3687` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 2) crates/loro-internal/src/state/movable_list_state.rs:1675— crates/loro-internal/src/state/movable_list_state.rs:1675-1694 | crates/loro-internal/src/state/movable_list_state.rs:1770-1789 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/movable_list_state.rs:1675` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:146— crates/fuzz/src/crdt_fuzzer.rs:146-165 | crates/fuzz/src/crdt_fuzzer.rs:224-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
MovableListState::apply_diff_and_convert (cyclomatic 37) crates/loro-internal/src/state/movable_list_state.rs:1092— 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.
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.
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.
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.
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.
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.
Handler::apply_diff (cyclomatic 32) crates/loro-internal/src/handler.rs:1368— 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
ListDiffCalculator::calculate_diff (cyclomatic 26) crates/loro-internal/src/diff_calc.rs:945— ListDiffCalculator::calculate_diff has cyclomatic complexity 26 (threshold 15). Of this number, 16 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.
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.
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.
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.
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.
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.
ValueReader::recursive_read_value_type_and_content (cyclomatic 24) crates/loro-internal/src/encoding/value.rs:691— ValueReader::recursive_read_value_type_and_content has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
loro_common::value::values_eq (cyclomatic 20) crates/loro-common/src/value.rs:46— loro_common::value::values_eq has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
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.
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.
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.
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.
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.
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.
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.
ImportedValues::eq (cyclomatic 19) crates/loro-internal/src/oplog/known_history.rs:43— ImportedValues::eq 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
SsTableIter::new_scan (cyclomatic 17) crates/kv-store/src/sstable.rs:646— 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.
loro_wasm::convert::js_value_to_loro_value (cyclomatic 17) crates/loro-wasm/src/convert.rs:661— 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.1. Run `cargo update -p lz4_flex` and commit the updated lock.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
Handler::apply_diff (cognitive 61) crates/loro-internal/src/handler.rs:1368— 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
CausalWorkspace::summary_of (cognitive 32) crates/loro-internal/src/oplog/known_history.rs:973— CausalWorkspace::summary_of has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (31 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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
ValueReader::recursive_read_value_type_and_content (cognitive 29) crates/loro-internal/src/encoding/value.rs:691— ValueReader::recursive_read_value_type_and_content has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 5 (11 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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
SsTableIter::new_scan (cognitive 27) crates/kv-store/src/sstable.rs:646— 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.
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.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
loro_common::value::values_eq (cognitive 26) crates/loro-common/src/value.rs:46— loro_common::value::values_eq has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (7 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeleteSpanWithId::is_mergable (cognitive 26) crates/loro-internal/src/container/list/list_op.rs:228— 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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
PendingChangesRollback::rollback (cognitive 22) crates/loro-internal/src/oplog/pending_changes.rs:441— PendingChangesRollback::rollback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (7 pts), 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
jsonpath.compileJsonPathEventMatcher (cognitive 21) loro-js/src/runtime/jsonpath.ts:66— jsonpath.compileJsonPathEventMatcher has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), ternaries 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). None of this is in the body itself: all 21 points belong to 4 function items inside it that branch (positionsAfter, a function literal at line 69, a function literal at line 75, …). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
loro_fractional_index::new_between (cognitive 19) crates/fractional_index/src/lib.rs:80— loro_fractional_index::new_between has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ListHandler::apply_delta (cognitive 19) crates/loro-internal/src/handler.rs:3623— 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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
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.
RichtextStateLoader::try_apply_append_delta (cognitive 18) crates/loro-internal/src/state/richtext_state.rs:1209— 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.
VersionVector::partial_cmp (cognitive 18) crates/loro-internal/src/version.rs:406— 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.
ImVersionVector::partial_cmp (cognitive 18) crates/loro-internal/src/version.rs:450— 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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
index.newBetweenBytes (cognitive 18) packages/fractional-index/src/index.ts:482— index.newBetweenBytes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (5 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.
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.
ImportedValues::eq (cognitive 17) crates/loro-internal/src/oplog/known_history.rs:43— ImportedValues::eq has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), boolean chains 5, if/else 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
fractional-index.newBetween (cognitive 17) loro-js/src/runtime/fractional-index.ts:88— fractional-index.newBetween has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (5 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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 301 methods over the threshold — including the worst — and 1420 of the 5127 points over it (28%), 4.3× the next-largest file (crates/loro-internal/src/loro.rs at 332). 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.
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.
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.
Near-duplicate member pair (34 shared lines) crates/loro-internal/src/jsonpath/parser.rs:306— crates/loro-internal/src/jsonpath/parser.rs:306-346 | crates/loro-internal/src/jsonpath/parser.rs:432-473 — These two members are variants of one another: 34 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:3379-3393 | crates/loro-wasm/src/lib.rs:3940-3954 | crates/loro-wasm/src/lib.rs:4350-4363 | crates/loro-wasm/src/lib.rs:4793-4806 | crates/loro-wasm/src/lib.rs:5636-5649 — 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· Edited copy of a member (79 corresponding lines) · ×1
Edited copy of a member (79 corresponding lines) crates/loro-internal/src/container/richtext/tracker.rs:393— crates/loro-internal/src/container/richtext/tracker.rs:393-500 | crates/loro-internal/src/container/richtext/tracker.rs:507-585 — These two members are one piece of code written twice and then edited apart: 79 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (59 corresponding lines) · ×1
Edited copy of a member (59 corresponding lines) crates/loro-internal/src/state/tree_state.rs:170— crates/loro-internal/src/state/tree_state.rs:170-228 | crates/loro-internal/src/state/tree_state.rs:1716-1782 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×1
Edited copy of a member (50 corresponding lines) crates/loro/src/event.rs:138— crates/loro/src/event.rs:138-187 | crates/loro/src/event.rs:191-240 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) crates/kv-store/src/mem_store.rs:442— crates/kv-store/src/mem_store.rs:442-483 | crates/kv-store/src/mem_store.rs:491-529 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 35+ corresponding lines) · ×1
Edited copies of one member (3 members, 35+ corresponding lines) crates/loro-internal/src/handler.rs:713— crates/loro-internal/src/handler.rs:713-747 | crates/loro-internal/src/handler.rs:844-878 | crates/loro-internal/src/handler.rs:954-988 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) crates/generic-btree/src/lib.rs:2472— crates/generic-btree/src/lib.rs:2472-2526 | crates/generic-btree/src/lib.rs:2528-2568 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 41+ corresponding lines) · ×1
Edited copies of one member (3 members, 41+ corresponding lines) crates/loro-internal/src/handler.rs:2845— crates/loro-internal/src/handler.rs:2845-2897 | crates/loro-internal/src/handler.rs:3581-3621 | crates/loro-internal/src/handler.rs:4317-4357 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 41 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) crates/kv-store/src/iter.rs:38— crates/kv-store/src/iter.rs:38-75 | crates/kv-store/src/iter.rs:79-115 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) crates/kv-store/src/block.rs:683— crates/kv-store/src/block.rs:683-715 | crates/kv-store/src/block.rs:717-749 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) crates/loro-internal/src/handler.rs:3372— crates/loro-internal/src/handler.rs:3372-3397 | crates/loro-internal/src/handler.rs:3745-3773 | crates/loro-internal/src/handler.rs:3942-3973 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) crates/loro-internal/src/handler.rs:4659— crates/loro-internal/src/handler.rs:4659-4691 | crates/loro-internal/src/handler.rs:4699-4725 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×1
Edited copies of one member (3 members, 13+ corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs:468— crates/loro-internal/src/state/container_store/container_wrapper.rs:468-484 | crates/loro-internal/src/state/container_store/container_wrapper.rs:486-498 | crates/loro-internal/src/state/container_store/container_wrapper.rs:504-521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 12+ corresponding lines) · ×1
Edited copies of one member (5 members, 12+ corresponding lines) crates/loro-internal/src/state/container_store/container_wrapper.rs:302— crates/loro-internal/src/state/container_store/container_wrapper.rs:302-313 | crates/loro-internal/src/state/container_store/container_wrapper.rs:315-330 | crates/loro-internal/src/state/container_store/container_wrapper.rs:408-423 | crates/loro-internal/src/state/container_store/container_wrapper.rs:429-442 | crates/loro-internal/src/state/container_store/container_wrapper.rs:448-461 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) crates/loro-internal/src/awareness.rs:71— crates/loro-internal/src/awareness.rs:71-90 | crates/loro-internal/src/awareness.rs:640-658 | crates/loro-internal/src/awareness.rs:660-677 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) crates/generic-btree/src/lib.rs:1684— crates/generic-btree/src/lib.rs:1684-1698 | crates/generic-btree/src/lib.rs:1700-1714 | crates/generic-btree/src/lib.rs:2715-2729 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×1
Edited copies of one member (5 members, 15+ corresponding lines) crates/loro-internal/src/version.rs:280— crates/loro-internal/src/version.rs:280-294 | crates/loro-internal/src/version.rs:778-794 | crates/loro-internal/src/version.rs:839-855 | crates/loro-internal/src/version.rs:857-871 | crates/loro-internal/src/version.rs:873-887 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 11+ corresponding lines) · ×1
Edited copies of one member (6 members, 11+ corresponding lines) crates/loro-wasm/src/counter.rs:111— crates/loro-wasm/src/counter.rs:111-122 | crates/loro-wasm/src/lib.rs:3451-3462 | crates/loro-wasm/src/lib.rs:3997-4007 | crates/loro-wasm/src/lib.rs:4408-4419 | crates/loro-wasm/src/lib.rs:4851-4862 | crates/loro-wasm/src/lib.rs:5676-5687 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 9+ corresponding lines) · ×1
Edited copies of one member (4 members, 9+ corresponding lines) crates/loro-internal/src/handler.rs:804— crates/loro-internal/src/handler.rs:804-812 | crates/loro-internal/src/handler.rs:814-822 | crates/loro-internal/src/handler.rs:921-929 | crates/loro-internal/src/handler.rs:931-939 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 10+ corresponding lines) · ×1
Edited copies of one member (6 members, 10+ corresponding lines) crates/loro-wasm/src/lib.rs:1300— crates/loro-wasm/src/lib.rs:1300-1309 | crates/loro-wasm/src/lib.rs:1326-1335 | crates/loro-wasm/src/lib.rs:1352-1361 | crates/loro-wasm/src/lib.rs:1378-1387 | crates/loro-wasm/src/lib.rs:1394-1403 | crates/loro-wasm/src/lib.rs:1420-1429 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) crates/loro-internal/src/handler.rs:3857— crates/loro-internal/src/handler.rs:3857-3866 | crates/loro-internal/src/handler.rs:4629-4638 | crates/loro-internal/src/handler/tree.rs:366-375 | crates/loro-internal/src/handler/tree.rs:698-708 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) crates/loro-internal/src/history_cache.rs:652— crates/loro-internal/src/history_cache.rs:652-658 | crates/loro-internal/src/history_cache.rs:862-868 | crates/loro-internal/src/history_cache.rs:884-890 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 8+ corresponding lines) · ×1
Edited copies of one member (6 members, 8+ corresponding lines) crates/loro-internal/src/loro.rs:1396— crates/loro-internal/src/loro.rs:1396-1403 | crates/loro-internal/src/loro.rs:1416-1423 | crates/loro-internal/src/loro.rs:1436-1445 | crates/loro-internal/src/loro.rs:1458-1465 | crates/loro-internal/src/loro.rs:1478-1485 | crates/loro-internal/src/loro.rs:1499-1506 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×1
Edited copy of a member (4 corresponding lines) crates/loro-common/src/value.rs:118— crates/loro-common/src/value.rs:118-121 | crates/loro-common/src/value.rs:123-128 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×1
Edited copy of a member (5 corresponding lines) crates/loro-wasm/src/lib.rs:3485— crates/loro-wasm/src/lib.rs:3485-3489 | crates/loro/src/lib.rs:3339-3343 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (34 lines × 2) crates/loro-internal/src/handler.rs:3588— crates/loro-internal/src/handler.rs:3588-3621 | crates/loro-internal/src/handler.rs:4324-4357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro/src/event.rs:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `&'a DiffInner` in one and `DiffInner` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (27–28 lines × 2) crates/loro-internal/src/history_cache.rs:95— crates/loro-internal/src/history_cache.rs:95-122 | crates/loro-internal/src/history_cache.rs:173-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/history_cache.rs:95` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/loro-internal/src/history_cache.rs:172` calls `visit_all_changes` and `crates/loro-internal/src/history_cache.rs:93` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (28 lines × 2) crates/loro-internal/src/version.rs:569— crates/loro-internal/src/version.rs:569-596 | crates/loro-internal/src/version.rs:603-630 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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.
Duplicated block (24 lines × 2) crates/loro-internal/src/jsonpath/parser.rs:390— crates/loro-internal/src/jsonpath/parser.rs:390-413 | crates/loro-internal/src/jsonpath/parser.rs:445-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/loro-internal/src/jsonpath/parser.rs:469` calls `parse_logical_or_expression` and `crates/loro-internal/src/jsonpath/parser.rs:414` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/value.rs:316` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (22 lines × 2) crates/loro-wasm/src/lib.rs:4179— crates/loro-wasm/src/lib.rs:4179-4200 | crates/loro-wasm/src/lib.rs:4621-4642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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:382-402 | crates/loro-internal/src/encoding/outdated_encode_reordered.rs:477-497 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/encoding/outdated_encode_reordered.rs:307` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/history_cache.rs:448` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–18 lines × 2) crates/loro-internal/src/handler.rs:2923— crates/loro-internal/src/handler.rs:2923-2940 | crates/loro-internal/src/state/richtext_state.rs:282-296 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:2923` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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:1726-1743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/state/tree_state.rs:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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.
Duplicated block (14–15 lines × 2) crates/loro-internal/src/handler.rs:3566— crates/loro-internal/src/handler.rs:3566-3579 | crates/loro-internal/src/handler.rs:4282-4296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3566` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 6) crates/loro-wasm/src/counter.rs:72— crates/loro-wasm/src/counter.rs:72-84 | crates/loro-wasm/src/lib.rs:3380-3393 | crates/loro-wasm/src/lib.rs:3941-3954 | crates/loro-wasm/src/lib.rs:4351-4363 | crates/loro-wasm/src/lib.rs:4794-4806 | crates/loro-wasm/src/lib.rs:5637-5649 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13–14 lines × 2) crates/generic-btree/src/generic_impl/ord.rs:279— crates/generic-btree/src/generic_impl/ord.rs:279-291 | crates/loro-internal/src/state/tree_state.rs:581-594 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/generic-btree/src/generic_impl/ord.rs:279` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) crates/loro-internal/src/state/richtext_state.rs:143— crates/loro-internal/src/state/richtext_state.rs:143-155 | crates/loro-internal/src/state/richtext_state.rs:200-212 | crates/loro-internal/src/state/richtext_state.rs:228-240 | crates/loro-internal/src/state/richtext_state.rs:1530-1542 — 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.
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 6 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 3) crates/fuzz/src/crdt_fuzzer.rs:1090— crates/fuzz/src/crdt_fuzzer.rs:1090-1100 | crates/fuzz/src/mem_kv_fuzzer.rs:281-291 | crates/loro-internal/src/fuzz.rs:9-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 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:1090` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs:89` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 4) crates/fuzz/src/crdt_fuzzer.rs:964— crates/fuzz/src/crdt_fuzzer.rs:964-973 | crates/fuzz/src/crdt_fuzzer.rs:1090-1098 | crates/fuzz/src/mem_kv_fuzzer.rs:281-289 | crates/loro-internal/src/fuzz.rs:9-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 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–17 lines × 2) crates/loro-internal/src/handler.rs:3777— crates/loro-internal/src/handler.rs:3777-3793 | crates/loro-internal/src/handler.rs:3976-3985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3777` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–15 lines × 4) crates/loro-internal/src/encoding/shallow_snapshot.rs:88— crates/loro-internal/src/encoding/shallow_snapshot.rs:88-94 | crates/loro-internal/src/oplog/change_store.rs:392-402 | crates/loro-internal/src/oplog/change_store.rs:451-465 | crates/loro-internal/src/oplog/change_store.rs:1240-1246 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/oplog/change_store.rs:392` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/generic-btree/src/generic_impl/gap_buffer.rs:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 5) crates/fuzz/src/crdt_fuzzer.rs:1021— crates/fuzz/src/crdt_fuzzer.rs:1021-1028 | crates/fuzz/src/crdt_fuzzer.rs:1097-1104 | crates/fuzz/src/mem_kv_fuzzer.rs:288-295 | crates/loro-internal/src/fuzz.rs:17-24 | crates/loro-internal/src/fuzz.rs:46-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 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:1021` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (4–7 lines × 3) crates/loro-internal/src/handler.rs:3382— crates/loro-internal/src/handler.rs:3382-3388 | crates/loro-internal/src/handler.rs:3959-3965 | crates/loro-internal/src/handler.rs:4056-4059 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/handler.rs:3382` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/loro-wasm-tools/src/main.rs:237` calls `sort_by_key` and `crates/loro-wasm-tools/src/main.rs:168` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 3) crates/loro-internal/src/state/list_state.rs:786— crates/loro-internal/src/state/list_state.rs:786-790 | crates/loro-internal/src/state/movable_list_state.rs:1606-1610 | crates/loro-internal/src/state/tree_state.rs:1960-1964 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 4) crates/loro-internal/src/handler.rs:2828— crates/loro-internal/src/handler.rs:2828-2833 | crates/loro-internal/src/handler.rs:3500-3505 | crates/loro-internal/src/handler.rs:4213-4218 | 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.
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:2877-2881 | crates/loro-internal/src/loro.rs:4066-4073 | crates/loro-internal/src/loro.rs:4079-4083 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/loro-internal/src/loro.rs:4066` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `callback` to `LocalEphemeralCallback` in one and `LocalUpdateCallback` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Near-duplicate member pair (112 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: 112 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copies of one member (6 members, 25+ corresponding lines) · ×1
Edited copies of one member (6 members, 25+ corresponding lines) crates/fuzz/src/container/counter.rs:28— crates/fuzz/src/container/counter.rs:28-58 | crates/fuzz/src/container/list.rs:29-59 | crates/fuzz/src/container/map.rs:24-50 | crates/fuzz/src/container/movable_list.rs:30-57 | crates/fuzz/src/container/text.rs:40-64 | crates/fuzz/src/container/tree.rs:117-149 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) crates/fuzz/src/container/list.rs:77— crates/fuzz/src/container/list.rs:77-82 | crates/fuzz/src/container/map.rs:73-82 | crates/fuzz/src/container/tree.rs:157-167 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:288` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/container/counter.rs:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (25 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:360— crates/fuzz/src/crdt_fuzzer.rs:360-384 | crates/fuzz/src/one_doc_fuzzer.rs:791-815 — 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:360` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20–23 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:760— crates/fuzz/src/crdt_fuzzer.rs:760-782 | crates/fuzz/src/crdt_fuzzer.rs:846-865 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:846` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 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 190 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/crdt_fuzzer.rs:323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/fuzz/src/actor.rs:607— crates/fuzz/src/actor.rs:607-623 | crates/fuzz/src/actor.rs:624-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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/fuzz/src/one_doc_fuzzer.rs:361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/fuzz/src/crdt_fuzzer.rs:819— crates/fuzz/src/crdt_fuzzer.rs:819-825 | crates/fuzz/src/crdt_fuzzer.rs:827-834 — both copies are in the same file, so extract the 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 × 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 190 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Complex function recomputeVisibility (cyclomatic 24, cognitive 12) loro-js/src/runtime/sequence-index.ts:3074— recomputeVisibility has cyclomatic complexity 24 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function lookupChild (cyclomatic 23, cognitive 33) loro-js/src/runtime/jsonpath.ts:369— lookupChild has cyclomatic complexity 23 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function fugueInsertion (cyclomatic 23, cognitive 22) loro-js/src/runtime/containers.ts:3598— fugueInsertion has cyclomatic complexity 23 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function recompute (cyclomatic 23, cognitive 15) loro-js/src/runtime/sequence-index.ts:3131— recompute has cyclomatic complexity 23 and cognitive complexity 15; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function decodedOperationToJson (cyclomatic 23, cognitive 13) REDACTED:9917— decodedOperationToJson has cyclomatic complexity 23 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function assertTwinAgrees (cyclomatic 22, cognitive 35) loro-js/tests/differential/harness.ts:385— assertTwinAgrees has cyclomatic complexity 22 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.
Complex function writeSleb128 (cyclomatic 22, cognitive 25) loro-js/src/codec/leb128.ts:94— writeSleb128 has cyclomatic complexity 22 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function containerDiff (cyclomatic 21, cognitive 30) REDACTED:10702— containerDiff has cyclomatic complexity 21 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function encodeChangeBlock (cyclomatic 21, cognitive 27) loro-js/src/codec/change-block-codec.ts:234— encodeChangeBlock has cyclomatic complexity 21 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.
Complex function styleValuesEqual (cyclomatic 21, cognitive 17) loro-js/src/runtime/containers.ts:2491— styleValuesEqual has cyclomatic complexity 21 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.
Complex function rewrite (cyclomatic 20, cognitive 37) loro-js/src/codec/sstable.ts:162— rewrite has cyclomatic complexity 20 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function indexedFugueInsertion (cyclomatic 20, cognitive 37) loro-js/src/runtime/containers.ts:3721— indexedFugueInsertion has cyclomatic complexity 20 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function visitVisibleStorageRange (cyclomatic 20, cognitive 36) loro-js/src/runtime/sequence-index.ts:3770— visitVisibleStorageRange has cyclomatic complexity 20 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function #finishSpanAppend (cyclomatic 20, cognitive 27) loro-js/src/runtime/sequence-index.ts:2237— #finishSpanAppend has cyclomatic complexity 20 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.
Complex function alignText (cyclomatic 20, cognitive 24) REDACTED:11328— alignText has cyclomatic complexity 20 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 is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function #appendToPreviousNodeWithLineBreaks (cyclomatic 20, cognitive 23) loro-js/src/runtime/sequence-index.ts:2143— #appendToPreviousNodeWithLineBreaks has cyclomatic complexity 20 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function generateEdit (cyclomatic 20, cognitive 13) loro-js/tests/differential/fuzz.ts:324— generateEdit has cyclomatic complexity 20 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function containerPath (cyclomatic 19, cognitive 33) REDACTED:11461— containerPath has cyclomatic complexity 19 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function #markLocatedIdSpanVisibility (cyclomatic 19, cognitive 32) loro-js/src/runtime/sequence-index.ts:1292— #markLocatedIdSpanVisibility has cyclomatic complexity 19 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function visitVisibleIdRuns (cyclomatic 19, cognitive 27) loro-js/src/runtime/sequence-index.ts:3469— visitVisibleIdRuns has cyclomatic complexity 19 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.
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: 507 lines of code packages/fractional-index/src/index.ts:1— packages/fractional-index/src/index.ts has 507 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.
crates/loro-wasm/index.ts: 462 lines of code crates/loro-wasm/index.ts:1— crates/loro-wasm/index.ts has 462 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.
Dead file (~116 LoC) scripts/run-js-doc-tests.ts— no import path from any entry point (63 application, 10 tooling, 115 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~49 LoC) crates/loro-internal/scripts/mem.ts— no import path from any entry point (63 application, 10 tooling, 115 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
Dead file (~36 LoC) crates/loro-internal/scripts/fuzz.ts— no import path from any entry point (63 application, 10 tooling, 115 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~9 LoC) crates/loro-internal/scripts/run_mem.ts— no import path from any entry point (63 application, 10 tooling, 115 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
Weak hash algorithm crates/loro-internal/src/encoding.rs:355— 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.
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.
Interpolated log message defeats structured logging crates/loro-internal/src/arena.rs:531— `info!` at line 531 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:544— `info!` at line 544 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:551— `info!` at line 551 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:2380— `error!` at line 2380 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:3763— `error!` at line 3763 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:4580— `warn!` at line 4580 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:3947— `info!` at line 3947 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`.
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/fuzz/src/mem_kv_fuzzer.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/kv-store/src/lib.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/fuzz/src/actions.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/container/richtext/tinyvec.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/kv-store/src/iter.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/delta/map.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.
Orphaned file crates/fractional_index/src/jitter.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.
redundant comment crates/loro-wasm/scripts/build.ts:151— "Update existing comment" repeats the code it sits on: 3 of its 3 words (update, existing, comment) are already in `await octokit.rest.issues.updateComment({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment crates/loro-wasm/tests/basic.test.ts:48— "Insert a text container to the list" repeats the code it sits on: 4 of its 4 words (insert, text, container, list) are already in `const text = list.insertContainer(0, new LoroText());`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment crates/loro-wasm/tests/basic.test.ts:1715— "Export JSON updates" repeats the code it sits on: 3 of its 3 words (export, json, updates) are already in `const jsonUpdates = doc.exportJsonUpdates();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment crates/loro-wasm/tests/richtext.test.ts:548— "Partial slice by UTF8" repeats the code it sits on: 3 of its 3 words (partial, slice, utf) are already in `const partialDeltaUtf8 = text.sliceDeltaUtf8(3, 10);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment crates/loro-wasm/tests/richtext.test.ts:556— "Empty slice by UTF8" repeats the code it sits on: 3 of its 3 words (empty, slice, utf) are already in `const emptyDeltaUtf8 = text.sliceDeltaUtf8(6, 6);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment loro-js/tests/diff-attached-children.test.ts:751— "Roots at `from`: [child, sibling]." repeats the code it sits on: 3 of its 3 words (roots, child, sibling) are already in `expect(tree.roots().map((root) => root.id)).toEqual([child.id, sibling.id]);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 25 significant file(s) lose their only recent owner: REDACTED, loro-js/src/runtime/sequence-index.ts, loro-js/src/runtime/containers.ts, crates/generic-btree/src/lib.rs, crates/generic-btree/src/generic_impl/rope.rs, crates/loro-internal/src/state/movable_list_state.rs, crates/loro-internal/src/container/richtext/tracker/id_to_cursor.rs, loro-js/src/runtime/movable-list.ts (+17 more). Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (27 single-owned of 202 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; 202 of the 272 production source files in this repository met that bar). They are anonymized user #2 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: crates/loro-internal/src/utils/query_by_len.rs.
Documentation: no build, run or usage example crates/loro-wasm-map/README.md:1— `loro-wasm-map` is a published package (`REDACTED` without `"private": true`) and neither `crates/loro-wasm-map/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
No ADRs found crates/loro-wasm-tools/src/main.rs:1— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `crates/loro-wasm-tools/src/main.rs` makes this repository a deployable product (line 1).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 2 of 18 project(s) overshoot their size bounds, lowering Project Cohesion to 7.8/10. The most over is `crates/loro-internal` (84009 LoC, 288 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.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 11 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/fuzz/src/mem_kv_fuzzer.rs, crates/loro-internal/src/allocation/bfs.rs, crates/kv-store/src/lib.rs, crates/fuzz/src/actions.rs, crates/loro-internal/src/container/richtext/tinyvec.rs, crates/kv-store/src/iter.rs (and 3 more) (12 orphaned of 202 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; 202 of the 272 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
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`.
No dependency-update automation REDACTED:36— `REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
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.
Null assertions (`!`) override strict null checking — ~16.5 `!` null assertions per 1k TypeScript source lines — 565 assertion(s) across the 34145 source line(s) of the 49 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. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
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.11 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.107 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: loom — `loom` is locked at 0.7.2 but 0.7.3 is the current stable release on crates.io, and it already satisfies the `"0.7"` requirement declared in crates/loro-internal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p loom` 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.6 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.6 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.5 is the current stable release on crates.io, and it already satisfies the `"1.8.0"` requirement declared in crates/loro-common/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.
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.
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.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1db42-4d44-714f-b3f1-419473298817 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 97 · Warnings: 1270 · Recommendations: 74 · Info: 34 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 18:11 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.