Public report of xberg-io/xberg, published 27 October 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). 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, 27 October 2026, 07:10 UTC Β· Survey ID cd_f5c22a3c864c4cd7a55db5f487f85ba7

xberg-io/xberg

Measured 27 October 2026, 07:05 UTC, at code version 7e63a48

Regression: 1 dimension fell since the last survey Code coverage: not measuredBoundary Type-Coupling: not measured

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

Code coverage is not measured: .NET and JavaScript/TypeScript suite (CouldNotMeasureNoCollector, CouldNotMeasureEnvironment).

Boundary Type-Coupling is not measured: Bounded contexts not declared.

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

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

A very large codebase: 816,638 lines of product code in 26 projects, tests not counted Β· Estimated rebuild effort: about 6.9 person-years Β· Weakest lens: Security and Compliance, 40

Findings by how serious they are

886 critical 2599 serious 116 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
27 October 2026, 07:05 UTC

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

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

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

86of 86 dimensions measured by tools.
3568of 3601 findings point to an exact file and line, so you can open each one in the code. The other 33 concern the repository as a whole, such as missing documentation.
86dimensions across 6 lenses, read from 816,638 lines of product code in 26 projects.
Chapters

Executive summary

xberg-io/xberg is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because we found no encryption of stored data, no key vault and no enforced HTTPS, and it has passwords or keys in the code's history. It scores 51 out of 100, which the At risk rating leaves unchanged.

Security and Compliance, at 40, is the weakest lens and counts most in the score. The best first step is encrypting the sensitive stored data and keeping its keys in a vault, worth about 9 points. Replacing the three exposed passwords or keys and switching the old ones off comes next, worth about 5 points. Raising Security and Compliance to 70 would lift the score to about 60.

689 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. 110 passwords or keys in the code's history and three in the code are open to anyone who can read the repository, and thirty secrets can leak from the build pipeline. Pinning each tool to an exact version, replacing each exposed password or key and limiting each secret to its own step would close these risks. Updating the vulnerable packages would fix the 16 packages with a known security hole, and passing outside input through environment variables would deal with the 13 pipeline steps that put outside input straight into a shell command. The set of compiler warnings switched off in a project needs turning back on in the build file.

The product code is 816,638 lines, about €1,000,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Security and Compliance 40 Β· counts for 46%Production Readiness 53 Β· counts for 25%Code Health 62 Β· counts for 14%Performance 65 Β· counts for 8%Maturity 76 Β· counts for 4%Architecture 93 Β· counts for 2%

If Security and Compliance rose from 40 to 70, the lowest score rated Strong, the score would rise from 51 to about 60.

Code composition: what the lines of code are
Business logic 0%Supporting code 0%Tests 100%
New since the last survey: 297 findings

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

  • Cyclomatic Complexity Β· RstExtractor::build_internal_document_within (cyclomatic 182) crates/xberg/src/extractors/rst.rs
  • Cyclomatic Complexity Β· xberg::pdf::structure::pipeline::build_document_structure (cyclomatic 58) crates/xberg/src/pdf/structure/pipeline.rs
  • Cyclomatic Complexity Β· JupyterExtractor::terminal_text (cyclomatic 29) crates/xberg/src/extractors/jupyter.rs
  • Cyclomatic Complexity Β· LatexExtractor::strip_inline_commands_with_symbols (cyclomatic 28) crates/xberg/src/extractors/latex/mod.rs
  • Cyclomatic Complexity Β· xberg::extractors::pdf::assign_formula_slots (cyclomatic 18) crates/xberg/src/extractors/pdf/mod.rs
  • Cyclomatic Complexity Β· xberg_native_pdf::fonts::cmap::line_parsers::parse_bfchar_line (cyclomatic 18) crates/xberg-native-pdf/src/fonts/cmap/line_parsers.rs
  • Cyclomatic Complexity Β· RstReferences::collect (cyclomatic 17) crates/xberg/src/extractors/rst.rs
  • Cyclomatic Complexity Β· xberg::extraction::docx::table::parse_row_properties (cyclomatic 17) crates/xberg/src/extraction/docx/table/mod.rs
  • Cyclomatic Complexity Β· xberg::extraction::ppt::read_table (cyclomatic 17) crates/xberg/src/extraction/ppt/mod.rs
  • Cyclomatic Complexity Β· FictionBookExtractor::extract_footnote_text (cyclomatic 16) crates/xberg/src/extractors/fictionbook.rs
  • Cyclomatic Complexity Β· OrgModeExtractor::is_structural_start (cyclomatic 16) crates/xberg/src/extractors/orgmode.rs
  • Cyclomatic Complexity Β· TextParser::handle_skipped_control_word (cyclomatic 16) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cyclomatic Complexity Β· xberg::extraction::image::tiff_pixel_density_dpi (cyclomatic 16) crates/xberg/src/extraction/image.rs
  • Cyclomatic Complexity Β· XYCutStrategy::find_horizontal_split_indexed (cyclomatic 16) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs
  • Cognitive Complexity Β· RstExtractor::build_internal_document_within (cognitive 417) crates/xberg/src/extractors/rst.rs
  • Cognitive Complexity Β· xberg::pdf::structure::pipeline::build_document_structure (cognitive 162) crates/xberg/src/pdf/structure/pipeline.rs
  • Cognitive Complexity Β· LatexExtractor::strip_inline_commands_with_symbols (cognitive 57) crates/xberg/src/extractors/latex/mod.rs
  • Cognitive Complexity Β· JupyterExtractor::terminal_text (cognitive 55) crates/xberg/src/extractors/jupyter.rs
  • Cognitive Complexity Β· xberg_native_pdf::fonts::cmap::line_parsers::parse_bfchar_line (cognitive 43) crates/xberg-native-pdf/src/fonts/cmap/line_parsers.rs
  • Cognitive Complexity Β· RstReferences::collect (cognitive 33) crates/xberg/src/extractors/rst.rs
  • Cognitive Complexity Β· xberg::extractors::pdf::assign_formula_slots (cognitive 32) crates/xberg/src/extractors/pdf/mod.rs
  • Cognitive Complexity Β· PdfDocument::order_extracted_spans (cognitive 28) crates/xberg-native-pdf/src/document/extract_api.rs
  • Cognitive Complexity Β· xberg::extraction::office_art::find_blip (cognitive 25) crates/xberg/src/extraction/office_art.rs
  • Cognitive Complexity Β· PdfDocument::compute_invisible_text_ratio (cognitive 25) crates/xberg-native-pdf/src/document/classify.rs
  • Cognitive Complexity Β· xberg::extractors::pdf::complete_formula_assignment (cognitive 23) crates/xberg/src/extractors/pdf/mod.rs
  • Cognitive Complexity Β· AsciiDocParser::substitute_attributes (cognitive 22) crates/xberg/src/extractors/asciidoc.rs
  • Cognitive Complexity Β· xberg::extraction::ppt::read_table (cognitive 22) crates/xberg/src/extraction/ppt/mod.rs
  • Cognitive Complexity Β· ScriptIndex::read_page (cognitive 20) crates/xberg/src/extraction/doc/chpx.rs
  • Cognitive Complexity Β· CommentState::strip_new_comment (cognitive 20) crates/xberg/src/extractors/latex/utilities.rs
  • Cognitive Complexity Β· xberg::extraction::doc::images::extract_pictures (cognitive 20) crates/xberg/src/extraction/doc/images.rs
  • Cognitive Complexity Β· xberg_native_pdf::fonts::cmap::line_parsers::decode_bfrange_array_entry (cognitive 20) crates/xberg-native-pdf/src/fonts/cmap/line_parsers.rs
  • Cognitive Complexity Β· AsciiDocParser::parse_inline (cognitive 19) crates/xberg/src/extractors/asciidoc.rs
  • Cognitive Complexity Β· xberg::extraction::doc::images::picture_offset (cognitive 19) crates/xberg/src/extraction/doc/images.rs
  • Cognitive Complexity Β· xberg::extraction::docx::math::elements::collect_group_chr_pr (cognitive 19) crates/xberg/src/extraction/docx/math/elements.rs
  • Cognitive Complexity Β· sync_public_skills.validate_skills (cognitive 18) scripts/sync_public_skills.py
  • Cognitive Complexity Β· xberg::table_core::repeated_column_edge_words (cognitive 17) crates/xberg/src/table_core.rs
  • Cognitive Complexity Β· xberg::api::response::omit_image_data_fields (cognitive 16) crates/xberg/src/api/response.rs
  • Cognitive Complexity Β· xberg::extraction::archive::zip::extract_zip_text_content (cognitive 16) crates/xberg/src/extraction/archive/zip.rs
  • Cognitive Complexity Β· xberg::extractors::doc::push_paragraph_elements_with_images (cognitive 16) crates/xberg/src/extractors/doc.rs
  • Cognitive Complexity Β· verify_pi_package.verify_archive (cognitive 16) scripts/verify_pi_package.py
  • God Classes Β· FunctionTooLong: xberg::pdf::structure::pipeline::build_document_structure crates/xberg/src/pdf/structure/pipeline.rs
  • God Classes Β· MethodTooLong: RstExtractor.build_internal_document_within crates/xberg/src/extractors/rst.rs
  • God Classes Β· TooManyMethods: ExtractionConfig crates/xberg/src/core/config/extraction/core.rs
  • God Classes Β· FunctionTooLong: xberg::rendering::comrak_bridge::append_annotated_span crates/xberg/src/rendering/comrak_bridge.rs
  • God Classes Β· FileTooLong: doc/mod.rs crates/xberg/src/extraction/doc/mod.rs
  • God Classes Β· FileTooLong: extraction/mathml.rs crates/xberg/src/extraction/mathml.rs
  • God Classes Β· TooManyFunctions: xberg::rendering::common crates/xberg/src/rendering/common.rs
  • God Classes Β· FileTooLong: extractors/html.rs crates/xberg/src/extractors/html.rs
  • God Classes Β· FileTooLong: reranking/mod.rs crates/xberg/src/reranking/mod.rs
  • God Classes Β· FunctionTooLong: xberg::api::handlers::parse_multipart_extract_request crates/xberg/src/api/handlers.rs
  • God Classes Β· FunctionTooLong: xberg::extractors::jats::extract_para_with_annotations_jats crates/xberg/src/extractors/jats/mod.rs
  • God Classes Β· FunctionTooLong: xberg::pdf::structure::assembly::push_paragraph_element_by_kind crates/xberg/src/pdf/structure/assembly.rs
  • Code Duplication Β· Near-duplicate member pair (47 shared lines) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Edited copy of a member (37 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Edited copy of a member (43 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Edited copy of a member (11 corresponding lines) crates/xberg/src/layout/models/slanet.rs
  • Code Duplication Β· Edited copy of a member (18 corresponding lines) crates/xberg-native-pdf/src/document/mod.rs
  • Code Duplication Β· Members sharing a duplicated core (17 members, 50+ identical tokens) crates/xberg/src/extraction/docx/math/collect.rs
  • Code Duplication Β· Members sharing a duplicated core (13 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg-tesseract/src/api.rs
  • Code Duplication Β· Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg/src/extractors/doc.rs
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg-native-pdf/src/optional_content.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg-tesseract/src/api.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extraction/email/msg_props.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docx.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/rendering/djot.rs
  • Code Duplication Β· Duplicated block (38 lines × 2) crates/xberg-tesseract/src/mutable_iterator.rs
  • Code Duplication Β· Duplicated block (32–33 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (20–21 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (20 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (20 lines × 2) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Code Duplication Β· Duplicated block (18 lines × 2) crates/xberg/src/extraction/docx/table/mod.rs
  • Code Duplication Β· Duplicated block (16–17 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (17 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Code Duplication Β· Duplicated block (16 lines × 2) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Duplicated block (16 lines × 2) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (14–15 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (15 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Code Duplication Β· Duplicated block (14 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs
  • Code Duplication Β· Duplicated block (14 lines × 2) crates/xberg/src/extraction/docx/parser.rs
  • Code Duplication Β· Duplicated block (10–14 lines × 2) crates/xberg/src/extractors/markdown.rs
  • Code Duplication Β· Duplicated block (14 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs
  • Code Duplication Β· Duplicated block (11–13 lines × 2) crates/xberg/src/extraction/archive/zip.rs
  • Code Duplication Β· Duplicated block (13 lines × 2) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (12 lines × 2) crates/xberg-gliner/src/session.rs
  • Code Duplication Β· Duplicated block (10–11 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (11 lines × 3) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (11 lines × 3) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/extraction/docx/parser.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Code Duplication Β· Duplicated block (9–10 lines × 2) crates/xberg-native-pdf/src/optional_content.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg-pdfium-render/src/utils.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg/src/extractors/latex/mod.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs

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

Fixed since the last survey: 180 findings

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

  • Cyclomatic Complexity Β· RstExtractor::build_internal_document (cyclomatic 171) crates/xberg/src/extractors/rst.rs
  • Cyclomatic Complexity Β· ExtractionConfig::apply_env_overrides (cyclomatic 79) crates/xberg/src/core/config/extraction/env.rs
  • Cyclomatic Complexity Β· xberg::rendering::plain::render_plain (cyclomatic 70) crates/xberg/src/rendering/plain.rs
  • Cyclomatic Complexity Β· xberg::extractors::rtf::parser::text_extract::extract_text_from_rtf (cyclomatic 63) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cyclomatic Complexity Β· xberg::pdf::structure::pipeline::extract_document_structure_from_segments (cyclomatic 60) crates/xberg/src/pdf/structure/pipeline.rs
  • Cyclomatic Complexity Β· xberg::extractors::djot_format::rendering::render_block_to_djot (cyclomatic 42) crates/xberg/src/extractors/djot_format/rendering.rs
  • Cyclomatic Complexity Β· xberg::extractors::rtf::parser::formatting_extract::extract_rtf_formatting (cyclomatic 36) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Cyclomatic Complexity Β· xberg::extractors::djot_format::rendering::render_inline_content (cyclomatic 28) crates/xberg/src/extractors/djot_format/rendering.rs
  • Cyclomatic Complexity Β· LatexExtractor::strip_inline_commands (cyclomatic 24) crates/xberg/src/extractors/latex/mod.rs
  • Cyclomatic Complexity Β· TextEscapeCtx::handle_skipped_control_word (cyclomatic 19) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cyclomatic Complexity Β· xberg::extraction::doc::strip_doc_field_instructions (cyclomatic 19) crates/xberg/src/extraction/doc/mod.rs
  • Cyclomatic Complexity Β· xberg_native_pdf::fonts::cmap::parse_bfchar_line (cyclomatic 18) crates/xberg-native-pdf/src/fonts/cmap.rs
  • Cyclomatic Complexity Β· xberg_native_pdf::pipeline::reading_order::structure_tree::mcid_order_zigzags_columns (cyclomatic 18) crates/xberg-native-pdf/src/pipeline/reading_order/structure_tree.rs
  • Cyclomatic Complexity Β· TextEscapeCtx::handle_destination (cyclomatic 17) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cyclomatic Complexity Β· TatrModel::recognize (cyclomatic 17) crates/xberg/src/layout/models/tatr.rs
  • Cyclomatic Complexity Β· xberg::pdf::native::text::append_span_separator (cyclomatic 17) crates/xberg/src/pdf/native/text.rs
  • Cognitive Complexity Β· RstExtractor::build_internal_document (cognitive 390) crates/xberg/src/extractors/rst.rs
  • Cognitive Complexity Β· xberg::pdf::structure::pipeline::extract_document_structure_from_segments (cognitive 165) crates/xberg/src/pdf/structure/pipeline.rs
  • Cognitive Complexity Β· ExtractionConfig::apply_env_overrides (cognitive 115) crates/xberg/src/core/config/extraction/env.rs
  • Cognitive Complexity Β· xberg::extractors::rtf::parser::text_extract::extract_text_from_rtf (cognitive 99) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cognitive Complexity Β· xberg::extractors::rtf::parser::formatting_extract::extract_rtf_formatting (cognitive 64) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Cognitive Complexity Β· xberg::extractors::djot_format::rendering::render_block_to_djot (cognitive 57) crates/xberg/src/extractors/djot_format/rendering.rs
  • Cognitive Complexity Β· LatexExtractor::strip_inline_commands (cognitive 48) crates/xberg/src/extractors/latex/mod.rs
  • Cognitive Complexity Β· xberg_native_pdf::fonts::cmap::parse_bfchar_line (cognitive 43) crates/xberg-native-pdf/src/fonts/cmap.rs
  • Cognitive Complexity Β· xberg::extractors::djot_format::rendering::render_inline_content (cognitive 36) crates/xberg/src/extractors/djot_format/rendering.rs
  • Cognitive Complexity Β· xberg::engine::structured::prompts::substitute_vars (cognitive 35) crates/xberg/src/engine/structured/prompts.rs
  • Cognitive Complexity Β· PdfDocument::extract_spans_filtered_with_reading_order (cognitive 31) crates/xberg-native-pdf/src/document/extract_api.rs
  • Cognitive Complexity Β· PdfDocument::compute_invisible_text_ratio (cognitive 25) crates/xberg-native-pdf/src/document/open.rs
  • Cognitive Complexity Β· xberg::chunking::core::chunk_text_with_heading_source (cognitive 22) crates/xberg/src/chunking/core.rs
  • Cognitive Complexity Β· TatrModel::recognize (cognitive 20) crates/xberg/src/layout/models/tatr.rs
  • Cognitive Complexity Β· xberg_cli::commands::extract::batch::batch_command (cognitive 20) crates/xberg-cli/src/commands/extract/batch.rs
  • Cognitive Complexity Β· xberg_native_pdf::fonts::cmap::decode_bfrange_array_entry (cognitive 20) crates/xberg-native-pdf/src/fonts/cmap.rs
  • Cognitive Complexity Β· xberg_native_pdf::pipeline::reading_order::structure_tree::mcid_order_zigzags_columns (cognitive 20) crates/xberg-native-pdf/src/pipeline/reading_order/structure_tree.rs
  • Cognitive Complexity Β· xberg::extraction::doc::strip_doc_field_instructions (cognitive 19) crates/xberg/src/extraction/doc/mod.rs
  • Cognitive Complexity Β· xberg::extractors::rtf::parser::formatting_extract::spans_to_annotations (cognitive 19) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Cognitive Complexity Β· TextEscapeCtx::handle_skipped_control_word (cognitive 18) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Cognitive Complexity Β· check-ffi-declaration-parity.check_surface (cognitive 18) scripts/ci/check-ffi-declaration-parity.py
  • Cognitive Complexity Β· WhisperEngine::greedy_decode (cognitive 17) crates/xberg/src/transcription/engine.rs
  • God Classes Β· FunctionTooLong: xberg::pdf::structure::pipeline::extract_document_structure_from_segments crates/xberg/src/pdf/structure/pipeline.rs
  • God Classes Β· MethodTooLong: RstExtractor.build_internal_document crates/xberg/src/extractors/rst.rs
  • God Classes Β· MethodTooLong: ExtractionConfig.apply_env_overrides crates/xberg/src/core/config/extraction/env.rs
  • God Classes Β· FunctionTooLong: xberg::rendering::plain::render_plain crates/xberg/src/rendering/plain.rs
  • God Classes Β· TooManyFields: TextEscapeCtx crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • God Classes Β· FunctionTooLong: xberg::extractors::djot_format::rendering::render_block_to_djot crates/xberg/src/extractors/djot_format/rendering.rs
  • God Classes Β· FunctionTooLong: xberg::candle_ocr::glm_ocr_backend::process_paired crates/xberg/src/candle_ocr/glm_ocr_backend.rs
  • God Classes Β· ClassTooLong: AsciiDocParser crates/xberg/src/extractors/asciidoc.rs
  • God Classes Β· FunctionTooLong: xberg::extractors::djot_format::rendering::render_inline_content crates/xberg/src/extractors/djot_format/rendering.rs
  • God Classes Β· MethodTooLong: JupyterExtractor.build_internal_document_with_budget crates/xberg/src/extractors/jupyter.rs
  • God Classes Β· MethodTooLong: WhisperEngine.greedy_decode crates/xberg/src/transcription/engine.rs
  • God Classes Β· FileTooLong: document/open.rs crates/xberg-native-pdf/src/document/open.rs
  • Code Duplication Β· Near-duplicate member pair (63 shared lines) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Edited copy of a member (35 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Edited copy of a member (43 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Members sharing a duplicated core (16 members, 50+ identical tokens) crates/xberg/src/extraction/docx/math/collect.rs
  • Code Duplication Β· Members sharing a duplicated core (13 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg-tesseract/src/api.rs
  • Code Duplication Β· Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg/src/extractors/doc.rs
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg-tesseract/src/api.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extraction/email/msg_props.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extractors/docx.rs
  • Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/rendering/djot.rs
  • Code Duplication Β· Duplicated block (38 lines × 2) crates/xberg-tesseract/src/mutable_iterator.rs
  • Code Duplication Β· Duplicated block (24 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs
  • Code Duplication Β· Duplicated block (17 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs
  • Code Duplication Β· Duplicated block (16 lines × 2) crates/xberg/src/extraction/docx/table/mod.rs
  • Code Duplication Β· Duplicated block (16 lines × 2) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Duplicated block (14 lines × 2) crates/xberg/src/extraction/doc/metadata.rs
  • Code Duplication Β· Duplicated block (14 lines × 2) crates/xberg/src/extraction/docx/parser.rs
  • Code Duplication Β· Duplicated block (13 lines × 3) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (13 lines × 2) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (13 lines × 2) crates/xberg/src/extractors/markdown.rs
  • Code Duplication Β· Duplicated block (13 lines × 2) crates/xberg/src/transcription/engine.rs
  • Code Duplication Β· Duplicated block (12 lines × 2) crates/xberg/src/extraction/docx/drawing.rs
  • Code Duplication Β· Duplicated block (11 lines × 4) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (10–11 lines × 3) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/extraction/docx/parser.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Code Duplication Β· Duplicated block (11 lines × 2) crates/xberg/src/layout/models/slanet.rs
  • Code Duplication Β· Duplicated block (10 lines × 4) crates/xberg/src/extractors/docbook.rs
  • Code Duplication Β· Duplicated block (10 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (10 lines × 3) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (9–10 lines × 2) crates/xberg-native-pdf/src/optional_content.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg/src/extractors/latex/mod.rs
  • Code Duplication Β· Duplicated block (10 lines × 2) crates/xberg/src/extractors/rtf/parser/text_extract.rs
  • Code Duplication Β· Duplicated block (9 lines × 4) crates/xberg/src/extractors/fictionbook.rs
  • Code Duplication Β· Duplicated block (8–9 lines × 2) crates/xberg-native-pdf/src/optional_content.rs
  • Code Duplication Β· Duplicated block (9 lines × 2) crates/xberg/src/extraction/docx/math/elements.rs
  • Code Duplication Β· Duplicated block (9 lines × 2) crates/xberg/src/extraction/image.rs
  • Code Duplication Β· Duplicated block (8 lines × 10) crates/xberg/src/extraction/docx/math/collect.rs
  • Code Duplication Β· Duplicated block (8 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs
  • Code Duplication Β· Duplicated block (8 lines × 3) crates/xberg/src/extractors/latex/mod.rs
  • Code Duplication Β· Duplicated block (8 lines × 2) crates/xberg-native-pdf/src/rendering/sidecar.rs
  • Code Duplication Β· Duplicated block (8 lines × 2) crates/xberg/src/extractors/jats/parser.rs
  • Code Duplication Β· Duplicated block (8 lines × 2) crates/xberg/src/layout/models/slanet.rs
Rebuild cost: about €1,000,000 Β· Estimate
Cost to rebuild€330,000 to €1,700,000, for 5,523 to 17,522 hours of work, about 6.9 person-years for 4 to 13 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 51. 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.
SizeVery large: 816,638 lines of product code
Comment linesThe estimate prices 816,621 lines. Comment lines count towards the size of 816,638 lines but aren't priced as work.
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty.

Top priorities

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

1
Encrypt sensitive data at rest (ASP.NET Core Data Protection / column encryption) and manage keys in a vault.
Skip if delegated to infra (Postgres TDE, KMS, etc.).
Raises the score by about 9 points Β· Medium effort Β· Data Protection
2
Resolve the 3 Leaked secret finding(s) in REDACTED Scanning β€” start with REDACTED, REDACTED, REDACTED.
Raises the score by about 5 points Β· Low effort Β· REDACTED Scanning
3
Resolve the 1 No network policy finding(s) in Network Egress Confinement.
Raises the score by about 2 points Β· Low effort Β· Network Egress Confinement

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed Β· Value at risk
This code would cost about €1,000,000 to build again, about 6.9 person-years of work. Its weakest lens is Security and Compliance, at 40 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first Β· First action
Encrypt sensitive data at rest (ASP.NET Core Data Protection / column encryption) and manage keys in a vault. Of all the actions in this report, it raises the score most for the work it takes: about 9 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.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 1,423,273 lines over the last 90 days, which is about 5,772,163 lines a year. At that pace, the extra work comes to an estimated 560.2 to 3361.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture β€” module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch @xberg-io/langchain-xberg langchain-xberg @xberg-io/llamaindex-xberg llamaindex-xberg @xberg-io/n8n-nodes-xberg n8n-nodes-xberg @xberg-io/opencode-xberg opencode-xberg @xberg-io/xberg-cli xberg-cli RustBridge RustBridge RustBridgeC RustBridgeC RustBridge->RustBridgeC Xberg (SwiftPM) Xberg (SwiftPM) Xberg (SwiftPM)->RustBridge Xberg (SwiftPM)->RustBridgeC benchmark-harness benchmark-harness xberg (Cargo) xberg (Cargo) benchmark-harness->xberg (Cargo) crewai-xberg crewai-xberg xberg-candle-ocr xberg-candle-ocr xberg (Cargo)->xberg-candle-ocr xberg-gliner xberg-gliner xberg (Cargo)->xberg-gliner xberg-libheif xberg-libheif xberg (Cargo)->xberg-libheif xberg-libwpd xberg-libwpd xberg (Cargo)->xberg-libwpd xberg-native-pdf xberg-native-pdf xberg (Cargo)->xberg-native-pdf xberg-paddle-ocr xberg-paddle-ocr xberg (Cargo)->xberg-paddle-ocr xberg-pdfium-render xberg-pdfium-render xberg (Cargo)->xberg-pdfium-render xberg-tesseract xberg-tesseract xberg (Cargo)->xberg-tesseract xberg-cli (Cargo) xberg-cli (Cargo) xberg-cli (Cargo)->xberg (Cargo) __more__ +6 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

1378 modules, with 3886 dependencies between them. 16 loops run through 221 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1338 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses β†’1 io.xberg2 xberg.extraction.diagram3 xberg.plugins.traits4 xberg_native_pdf.crypto.error5 xberg.core.config.formats6 xberg.core.config.processing7 xberg.error8 xberg.pdf.hierarchy.bounding_box9 xberg.plugins.processor.trait10 xberg_native_pdf.functions11 xberg_native_pdf.object12 xberg.core.config.llm13 xberg.types.document_structure14 xberg.types.ocr_elements15 xberg.types.page16 xberg.core.config.ocr17 xberg.types.metadata18 xberg.plugins.ocr19 xberg.types.internal20 xberg.types.formats21 xberg_php22 xberg_wasm23 xberg.extractors.security24 xberg.extraction.docx.parser25 xberg.types.extraction26 xberg_native_pdf.document27 xberg.core.config.extraction.types28 xberg.types.internal_builder29 xberg_pdfium_render.pdf.document.page.object30 xberg.core.config.extraction.file_config31 xberg.core.config.extraction.core32 xberg.plugins.extractor.trait33 xberg_node34 xberg.core.config.acceleration35 crate.packages.ruby.ext.xberg_rb.src36 xberg_dart37 xberg_ffi38 xberg_nif39 xberg_py40 xberg_swift
1 io.xberg
2 xberg.extraction.diagram
3 xberg.plugins.traits
4 xberg_native_pdf.crypto.error
5 xberg.core.config.formats23
6 xberg.core.config.processing771
7 xberg.error11
8 xberg.pdf.hierarchy.bounding_box11
9 xberg.plugins.processor.trait11111
10 xberg_native_pdf.functions1
11 xberg_native_pdf.object1
12 xberg.core.config.llm21010
13 xberg.types.document_structure299
14 xberg.types.ocr_elements177
15 xberg.types.page1111111
16 xberg.core.config.ocr132261161
17 xberg.types.metadata1113541
18 xberg.plugins.ocr1244
19 xberg.types.internal1341115
20 xberg.types.formats112314115
21 xberg_php412111102715132216801252936282422298
22 xberg_wasm271117110971163541529131713112
23 xberg.extractors.security1111
24 xberg.extraction.docx.parser11532
25 xberg.types.extraction3111111117117
26 xberg_native_pdf.document3182
27 xberg.core.config.extraction.types1131113
28 xberg.types.internal_builder1341412
29 xberg_pdfium_render.pdf.document.page.object1
30 xberg.core.config.extraction.file_config12121151
31 xberg.core.config.extraction.core22221115111
32 xberg.plugins.extractor.trait212
33 xberg_node261371198318109711174146152913251611132
34 xberg.core.config.acceleration22
35 crate.packages.ruby.ext.xberg_rb.src2617161119371321915242689462560374632211310
36 xberg_dart892011435231725197611257037473625111
37 xberg_ffi8223221115619184311
38 xberg_nif267191119301914222887461061454538212310
39 xberg_py2671611191321915242789462560374734212310
40 xberg_swift8523112435231828199312388549464135112
Uses a module listed above itPart of a loopThe module itself
1 io.xberg2 xberg.extraction.diagram3 xberg.plugins.traits4 xberg_native_pdf.crypto.error5 xberg.core.config.formats6 xberg.core.config.processing7 xberg.error8 xberg.pdf.hierarchy.bounding_box9 xberg.plugins.processor.trait10 xberg_native_pdf.functions11 xberg_native_pdf.object12 xberg.core.config.llm13 xberg.types.document_structure14 xberg.types.ocr_elements15 xberg.types.page16 xberg.core.config.ocr17 xberg.types.metadata18 xberg.plugins.ocr19 xberg.types.internal20 xberg.types.formats21 xberg_php22 xberg_wasm23 xberg.extractors.security24 xberg.extraction.docx.parser25 xberg.types.extraction26 xberg_native_pdf.document27 xberg.core.config.extraction.types28 xberg.types.internal_builder29 xberg_pdfium_render.pdf.document.page.object30 xberg.core.config.extraction.file_config31 xberg.core.config.extraction.core32 xberg.plugins.extractor.trait33 xberg_node34 xberg.core.config.acceleration35 crate.packages.ruby.ext.xberg_rb.src36 xberg_dart37 xberg_ffi38 xberg_nif39 xberg_py40 xberg_swiftio.xberg1xberg.extraction.diagram2xberg.plugins.traits3xberg_native_pdf.crypto.error4xberg.core.config.formats5xberg.core.config.processing6xberg.error7xberg.pdf.hierarchy.bounding_box8xberg.plugins.processor.trait9xberg_native_pdf.functions10xberg_native_pdf.object11xberg.core.config.llm12xberg.types.document_structure13xberg.types.ocr_elements14xberg.types.page15xberg.core.config.ocr16xberg.types.metadata17xberg.plugins.ocr18xberg.types.internal19xberg.types.formats20xberg_php21xberg_wasm22xberg.extractors.security23xberg.extraction.docx.parser24xberg.types.extraction25xberg_native_pdf.document26xberg.core.config.extraction.types27xberg.types.internal_builder28xberg_pdfium_render.pdf.document.page.object29xberg.core.config.extraction.file_config30xberg.core.config.extraction.core31xberg.plugins.extractor.trait32xberg_node33xberg.core.config.acceleration34crate.packages.ruby.ext.xberg_rb.src35xberg_dart36xberg_ffi37xberg_nif38xberg_py39xberg_swift402377111111111111210102991771111111132261161111354112441341115112314115412111102715132216801252936282422298271117110971163541529131713112111111532311111111711731821131113134141211212115122221115111212261371198318109711174146152913251611132222617161119371321915242689462560374632211310892011435231725197611257037473625111822322111561918431126719111930191422288746106145453821231026716111913219152427894625603747342123108523112435231828199312388549464135112+1338 more modules (most-connected shown)

At a glance β€” Code Health Β· 62% Β· Adequate Β· gated by D2 Β·

At a glance β€” Architecture Β· 93% Β· Exemplary Β·

At a glance β€” Maturity Β· 76% Β· Strong Β·

At a glance β€” Readiness Β· 53% Β· Adequate Β· gated by D13, R4, R8 Β·

At a glance β€” Security Β· 40% Β· Weak Β· gated by D28, D29, D30, D31, C1 Β·

At a glance β€” Performance Β· 65% Β· Adequate Β·

Security & Compliance β€” OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 β€” Injection745High / Critical
A07:2025 β€” Authentication Failures114High / Critical
A02:2025 β€” Security Misconfiguration47High / Critical
A03:2025 β€” Software Supply Chain Failures29High / Critical

Roadmap

Immediately address security risks by encrypting sensitive data at rest and resolving all leaked secrets in both current files and repository history. Concurrently, remediate high-severity vulnerabilities in dependencies and clean up the project by removing unused packages and explicitly declaring imports.

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

Do thisHelpsEffortDimension
Encrypt sensitive data at rest (ASP.NET Core Data Protection / column encryption) and manage keys in a vault. Skip if delegated to infra (Postgres TDE, KMS, etc.).+9.2 ptsMediumData Protection
Resolve the 3 Leaked secret finding(s) in REDACTED Scanning β€” start with REDACTED, REDACTED, REDACTED.+4.5 ptsLowREDACTED Scanning
Resolve the 1 No network policy finding(s) in Network Egress Confinement.+1.9 ptsLowNetwork Egress Confinement
Resolve the 74 REDACTED finding(s) in Secrets (history) β€” start with REDACTED (24), REDACTED (2), REDACTED.+3.1 ptsMediumSecrets (history)
Resolve the 1 NoWarnInCsproj finding(s) in Explicit Debt β€” start with Xberg.Runtime.csproj.+1.5 ptsLowExplicit Debt
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.+2.5 ptsMediumDependency Hygiene
Resolve the 6 No assertions finding(s) in Test Quality β€” start with PluginApiTests.cs (6).+1.1 ptsLowTest Quality
Resolve the 10 High CVE finding(s) in Dependency Vulnerabilities β€” start with REDACTED (6), REDACTED (4).+1.9 ptsMediumDependency Vulnerabilities

File quality

Per-file score 0–10 β€” a quality signature. Of 576 files carrying findings, judged against the Production bar: 2% slop Β· 68% mixed Β· 30% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopREDACTED Scanning: Leaked secret: REDACTED
REDACTED1.4SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.6SlopREDACTED Scanning: Leaked secret: REDACTED
REDACTED1.9SlopSecrets (history): REDACTED: REDACTED
REDACTED1.9SlopSecrets (history): REDACTED: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.5SlopIaC & Container Security: High IaC: REDACTED
REDACTED4.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.4MixedSecrets (history): REDACTED: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it β€” and it is a grade, not a gap.

Critical β€” 886

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 β€” 2599

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 β€” 116

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

Could not be resolved β€” 8

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

Methodology & how to trust this report

Watchdog is a deep, periodic assessment β€” run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 86 of 86 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.8 β€” the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: βœ“ Measured β€” a deterministic fact (LoC, complexity, coverage); ~ Modeled β€” an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory β€” an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): βœ“ Tool-verified means the property itself was measured across the surface; β—‹ Nothing flagged means the probes came back clean β€” a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence β€” absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled Β· advisory marks an LLM verdict over a bounded sample β€” advisory, never a deterministic measurement.

What we checked β€” 86 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D17D20D26D28D29D30D31D34D35D36D37D40D41D43D44AX10AX3AX4AX5AX6AX9C1C4GD1IC1M1M2M3M4P1P10P3P4P5P6PF1PF2PF3R1R10R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X2X20X21X22X23X24X25X26X27X28X29X3X30X32X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality β€” in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report β€” three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line β€” never an absolute scratch path. Here, 3568 of 3601 do; the remainder are repo-wide signals β€” a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it β€” Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled Β· advisory β€” not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score β€” and this report, byte for byte β€” is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) β€” re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0βœ“ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0βœ“ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0βœ“ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400βœ“ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400βœ“ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 Β· 0.31.0βœ“ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 Β· 0.69.3 Β· 3.2.533βœ“ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming β€” sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM Β· sampled Β· advisory

Every finding is locatable in findings.md. Run 01a17c2d-c574-7cee-91aa-9ed58b064e9a.

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

Run transparency β€” what happened this run

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

  • D10 Test Quality β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 109 test(s) behind this row are the ones the C# collector could read, and this repository also carries at least 1,061 test source file(s) (.py, .rs, .ps1, .mjs, .ts, .cjs, .js) that it cannot: it parses C# syntax and matches C# test attributes, so a vitest/jest/JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite β€” their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: this repository's test suite spans .NET and JavaScript/TypeScript, and the JavaScript/TypeScript half could not be re-run β€” e2e: measured (0 flaky); JavaScript/TypeScript (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root; node:test via `pnpm install --frozen-lockfile --ignore-scripts` in crates/xberg-node/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in crates/xberg-wasm/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in e2e/node/; vitest via `pnpm install --frozen-lockfile --ignore-scripts` in e2e/wasm/; vitest via `npm ci --ignore-scripts` in integrations/node/langchain-xberg/; vitest via `npm ci --ignore-scripts` in integrations/node/llamaindex-xberg/): not included β€” the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. No partial figure is published as if it were the whole: reliability is excluded from the score rather than counted as a near-zero.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in the repository root was NOT MEASURED: the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the node:test suite in crates/xberg-node/ was NOT MEASURED: the dependency install for crates/xberg-node/ failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in crates/xberg-wasm/ was NOT MEASURED: the dependency install for crates/xberg-wasm/ failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in e2e/node/ was NOT MEASURED: the dependency install for e2e/node/ failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in e2e/wasm/ was NOT MEASURED: the dependency install for e2e/wasm/ failed in the analyzer sandbox (ENOENT  ENOENT: no such file or directory, scandir 'crates/xberg-wasm/pkg/nodejs'), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in integrations/node/langchain-xberg/ was NOT MEASURED: the dependency install for integrations/node/langchain-xberg/ failed in the analyzer sandbox (npm error code ETARGET), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D11 Test Reliability β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the vitest suite in integrations/node/llamaindex-xberg/ was NOT MEASURED: the dependency install for integrations/node/llamaindex-xberg/ failed in the analyzer sandbox (npm error code ETARGET), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D14 License Compliance β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Cargo manifest, but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its Cargo dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python REDACTED/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Swift Package.swift/Package.resolved, but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its SwiftPM dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares composer.json, but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its Composer dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its NuGet package dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor β€” not measured this run β€” This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository β€” bus factor is not applicable (71 contributor(s) across 10662 commit(s) sampled, automation and bot accounts excluded). One of them holds 92% of the history; the other 70 hold 0.1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated β€” so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D17 Explicit Debt β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1 deducted marker(s) and the 0.0/KLoC density on this row were taken over this repository's .NET projects ALONE: .rs (788,337 lines, 98% of production source) went unread, because every marker collector on this path is reached through a C# workspace. A read-only sweep of that source finds at least 50 task marker(s) (TODO/FIXME/HACK/XXX) across 30 file(s) that this score does not count β€” a floor, since only line comments are read there and D17's other eight marker kinds (suppressions, NoWarn, editorconfig severities, empty catches, commented-out code, Obsolete, dead code, preprocessor branches) need a compiler we do not have for that language. The debt in that source is UNMEASURED β€” its absence from the score above is a gap in this analyzer's language coverage, not a finding that the code carries none.
  • D19 Documentation Quality β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. 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.
  • D19 Documentation Quality β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run β€” this says nothing about whether its names are consistent.
  • D22 Internal API Consistency β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D23 Boundary Type-Coupling β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Large codebase (814,471 production LoC in the .NET projects) with no declared bounded contexts β€” cross-boundary type coupling is unassessed Bounded contexts cannot be inferred from a codebase that is not physically organised by them (D-321), so with none declared there are no boundaries for the coupling pass to measure across. You can widen what we reach: name this codebase's bounded contexts (β‰₯2 module groups, e.g. per subsystem) so cross-boundary type coupling can be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it β€” e.g. `architecture:` β†’ `contexts:` β†’ `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. 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 β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D39 IL Efficiency β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. IL NOT MEASURED: the analyzer's own build of this repository failed for an ENVIRONMENT reason (exit 1) β€” MSBuild's engine or the CLR gave up, or our image does not carry the SDK band/targeting pack this repository needs. This is OUR limitation, not a defect in the repo, and it is not a statement that this repository fails to build. D18 owns the question of whether this repository builds; it was not answered here.
  • D41 Kernel & Syscall Confinement β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Charts/xberg/templates/deployment.yaml:2 did not read as a pod spec (a templated manifest such as Helm's that is not YAML until rendered, or a workload whose pod spec this check does not locate), so the seccomp/AppArmor profile in force there was not judged and no row about them can appear on this card.
  • AXR1 Runtime accessibility β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via Dockerfile (REDACTED). docker build failed (exit 1) β€” 109 | 110 | >>> FROM debian:trixie-slim 111 | 112 | LABEL org.opencontainers.image.source="https://github.com/xberg-io/xberg" -------------------- ERROR: failed to solve: debian:trixie-slim: failed to resolve source metadata for docker.io/library/debian:trixie-slim: failed to do request: Head "https://registry-1.docker.io/v2/library/debian/manifests/trixie-slim": Forbidden; runtime evidence skipped.
  • M4 Documentation accuracy β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The filesystem refused the listing or the read of: e2e/dart/docx, e2e/dart/html, e2e/dart/images, e2e/dart/json, e2e/dart/pdf, e2e/dart/text, e2e/dart/xlsx, e2e/elixir/docx, e2e/elixir/html, e2e/elixir/images and 53 more. Every other path was read.
  • X3 Exception handling β€” measured, with a gap in what it reached β€” Watchdog measured this, but not all of it. What it did not reach is a gap on our side β€” a collector, parser or image we have not built yet β€” so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 24 further occurrence(s) are not listed individually; the score already reflects all 64.
  • X7 Silent fallback defaults β€” not measured this run β€” Watchdog could not measure this here. That is a gap on our side β€” a collector, parser or image we have not built yet β€” and it is neither a defect in this repository nor evidence that the check would have passed. 47 further occurrence(s) are not listed individually; the score already reflects all 87.

Repo exclusion declarations: 19 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored β€” auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically β€” it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type β€” a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module β€” one class/IIFE β€” earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity β€” an in-process token-stream comparison over sliding windows, with type-aware normalization β€” so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED β€” its repetition is the tool's, not the team's β€” so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies β€” runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic β€” it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals β€” a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural β€” it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles β€” a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree β€” a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy β€” mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history β€” a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual β€” undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded β€” it is never the team's dead code to delete.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present β€” it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project β€” a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns β€” a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) β€” it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases β€” a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules β€” it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension β€” code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS β€” files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests β€” a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
  • D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests β€” a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen β€” a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen β€” a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics β€” a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention β€” a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • C4 Data Retention: This control is scored from in-repo evidence only β€” its real-world effectiveness, exercised only at runtime, is outside a static scan.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present β€” it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see β€” only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence β€” a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) β€” controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 Β· Cyclomatic Complexity4.4 / 10Weakβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 4.4 / 10 Β· rule-coverage 100% Β· ceiling Prevented

322 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was FontInfo::std14_width at 462. A further 110 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 FontInfo::gid_to_standard_glyph_name at 219 β€” they are counted neither in the figure above nor in this dimension's score. 57 files carry no cyclomatic complexity row at all for this reason β€” every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/xberg/src/language_detection/mod.rs (xberg::language_detection::lang_to_iso639_3 at 70), crates/xberg-native-pdf/src/fonts/cff_encoding/mac_encoding_tables.rs (xberg_native_pdf::fonts::cff_encoding::mac_encoding_tables::mac_roman_high_byte_to_name_low at 65), crates/xberg-native-pdf/src/fonts/character_mapper.rs (CharacterMapper::glyph_name_windows1252_c1_controls at 65), crates/xberg-native-pdf/src/fonts/radical_forms.rs (xberg_native_pdf::fonts::radical_forms::cjk_radicals_supplement_to_ideograph_low at 61), crates/xberg-pdfium-render/src/pdf/document/page/size.rs (PdfPagePaperStandardSize::from_mm_dimensions at 53), and 52 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page (cyclomatic 140) Β· Γ—97crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310
xberg_native_pdf::fonts::font_dict::standard_encoding_lookup (cyclomatic 221) Β· Γ—62crates/xberg-native-pdf/src/fonts/font_dict.rs:6046
PdfDocument::assemble_text_from_spans (cyclomatic 108) Β· Γ—48crates/xberg-native-pdf/src/document/text_assembly.rs:313
PageRenderer::execute_operators (cyclomatic 167) Β· Γ—10crates/xberg-native-pdf/src/rendering/page_renderer.rs:966
TextExtractor::execute_operator (cyclomatic 103) Β· Γ—9crates/xberg-native-pdf/src/extractors/text/operators.rs:14

+ 56 more group(s) β€” more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 2 bodies over 240 down to 240 or less in Cyclomatic Complexity β€” start with FontInfo::std14_width (cyclomatic 462), MarkdownExtractor::build_internal_document_with_jsx (cyclomatic 254). β€” 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 4.4 to about 5.1/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D2 Β· Cognitive Complexity2.0 / 10Criticalβœ“ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 2.0 / 10 Β· rule-coverage 100% Β· ceiling Prevented

683 method(s) exceeded the cognitive complexity threshold of 15; the worst was MarkdownExtractor::build_internal_document_with_jsx at 466.

xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page (cognitive 327) Β· Γ—241crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310
xberg_native_pdf::rendering::separation_renderer::execute_separation_operators (cognitive 138) Β· Γ—122crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1489
PdfDocument::assemble_text_from_spans (cognitive 313) Β· Γ—76crates/xberg-native-pdf/src/document/text_assembly.rs:313
benchmark_harness::commands::run::register_external_adapters (cognitive 99) Β· Γ—24tools/benchmark-harness/src/commands/run.rs:567
PageRenderer::execute_operators (cognitive 358) Β· Γ—19crates/xberg-native-pdf/src/rendering/page_renderer.rs:966

+ 109 more group(s) β€” more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 10 bodies over 240 down to 240 or less in Cognitive Complexity β€” start with MarkdownExtractor::build_internal_document_with_jsx (cognitive 466), RstExtractor::build_internal_document_within (cognitive 417), DocxParser::parse_body_elements (cognitive 394). β€” This score is capped by its worst body, so a finding fixed alone moves it by almost nothing β€” the next one down takes its place. Refactoring these 10 together lifts Cognitive Complexity from 2.0 to about 3.0/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D3 Β· God Classes9.0 / 10Stronggated by 305 serious findingsβœ“ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.0 / 10 Β· rule-coverage 100% Β· ceiling Prevented

305 god class(es) detected.

FileTooLong: rendering/page_renderer.rs Β· Γ—119crates/xberg-native-pdf/src/rendering/page_renderer.rs
MethodTooLong: PageRenderer.execute_operators Β· Γ—65crates/xberg-native-pdf/src/rendering/page_renderer.rs:966
FunctionTooLong: xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page Β· Γ—56crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310
ClassTooLong: DynamicPdfiumBindings Β· Γ—26crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:35
TooManyMethods: PdfDocument Β· Γ—24crates/xberg-native-pdf/src/document/mod.rs:558

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

What to do

  1. Resolve the 119 FileTooLong finding(s) in God Classes β€” start with mod.rs (15), parser.rs (3), pipeline.rs (2). β€” One of this dimension's main actionable groups (119 warning-level).
  2. Resolve the 65 MethodTooLong finding(s) in God Classes β€” start with font_dict.rs (5), page_renderer.rs (4), mod.rs (3). β€” One of this dimension's main actionable groups (65 warning-level).
  3. Resolve the 56 FunctionTooLong finding(s) in God Classes β€” start with pipeline.rs (7), mod.rs (7), parser.rs (6). β€” One of this dimension's main actionable groups (56 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D4 Β· Code Duplication9.5 / 10Stronggated by 914 serious findingsβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.5 / 10 Β· rule-coverage 100% Β· ceiling Verified

864 duplicated block group(s) detected. A further 50 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 11 of the 914 are in trees this repository does not ship β€” vendored, example/demo, project-template, fixture and benchmark code β€” and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (7 lines × 2) Β· Γ—74crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:180
Duplicated block (5 lines × 2) Β· Γ—69crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:735
Duplicated block (9 lines × 2) Β· Γ—57crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:687
Duplicated block (10 lines × 2) Β· Γ—56crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:721
Duplicated block (6 lines × 2) Β· Γ—48crates/xberg-native-pdf/src/document/extract_api.rs:888

+ 201 more group(s) β€” more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 74 Duplicated block (7 lines × 2) finding(s) in Code Duplication β€” start with page_renderer.rs (6), mod.rs (5), parser.rs (4). β€” One of this dimension's main actionable groups (74 warning-level).
  2. Resolve the 69 Duplicated block (5 lines × 2) finding(s) in Code Duplication β€” start with mod.rs (7), images.rs (6), page_renderer.rs (6). β€” One of this dimension's main actionable groups (69 warning-level).
  3. Resolve the 57 Duplicated block (9 lines × 2) finding(s) in Code Duplication β€” start with parser.rs (5), mod.rs (4), docbook.rs (3). β€” One of this dimension's main actionable groups (57 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Verified β€” provenance only; does not change the score.

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

D5 Β· Coupling7.5 / 10Strongβœ“ Tool-verified

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

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 7.5 / 10 Β· rule-coverage 100% Β· ceiling Prevented

26 production modules (Maven+Cargo+npm+Python+SwiftPM+Composer), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 8 module(s) off the main sequence, with abstractness counted on 21 of the 26 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: xberg-candle-ocr Β· Γ—8

What to do

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

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

D6 Β· Cohesion (LCOM4)9.9 / 10Stronggated by 11 serious findingsβœ“ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class β€” the population is all types, not a name convention.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.9 / 10 Β· rule-coverage 100% Β· ceiling Verified

11 of 1607 classes have LCOM4 above 3.

Low cohesion: DynamicPdfiumBindings (LCOM4 446) Β· Γ—11crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:35

What to do

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

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

D9 Β· Test Distribution9.5 / 10Exemplaryβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.5 / 10 Β· rule-coverage 100% Β· ceiling Documented

21836 test methods: 15480 unit, 5541 integration, 13 BDD, 802 e2e. The JavaScript/TypeScript suite contributes 314 `it`/`test` case(s) across 48 test file(s) declaring at least one beside 109 .NET test method(s); its tier split is read from package names and paths only. The Rust suite contributes 20452 `#[test]` function(s) across 1709 file(s) declaring at least one; its unit/integration split is Cargo's own β€” 780 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 705 test function(s) across 59 file(s) declaring at least one β€” every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only. The Go suite contributes 109 test case(s) across 19 `_test.go` file(s) declaring at least one β€” every `func Test…(t *testing.T)` that `go test` would collect, plus the suite methods a testify-style runner reaches; a table-driven case list counts once, so this is a floor. Its tier split is INFERRED from file names, paths and build constraints, not declared: 19 of those file(s) use Go's external test package (`package x_test`), which is a visibility boundary rather than a pyramid tier and was not read as one. The java, swift suite(s) contribute 147 test method(s), read from the language model's own test census β€” every XCTest `test…` method on an XCTestCase, every swift-testing `@Test` and every JUnit/TestNG `@Test`-annotated method, which is those frameworks' own discovery rule. Their tier split is INFERRED from the test target's name and path only, not declared.

βœ“ On the Gold path β€” maintain.

Detailed fixes: d9_recommendation.md.

D10 Β· Test Quality9.2 / 10Stronggated by 6 serious findingsβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.2 / 10 Β· rule-coverage 100% Β· ceiling Prevented

0 skipped, 6 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 109 tests. Measured on the C# suite only β€” at least 1,061 test source file(s) (.py, .rs, .ps1, .mjs, .ts, .cjs, .js) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: Test_RegisterEmbeddingBackendTraitBridge Β· Γ—6e2e/csharp/tests/PluginApiTests.cs:25

What to do

  1. Resolve the 6 No assertions finding(s) in Test Quality β€” start with PluginApiTests.cs (6). β€” One of this dimension's main actionable groups (6 warning-level).
  2. Enforce Test Quality in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D12 Β· Dependency Hygiene9.9 / 10Exemplaryβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.9 / 10 Β· rule-coverage 100% Β· ceiling Verified

1 outdated, 0 retired direct Hex dependencies, 0 pinning defect(s). Whether any of these packages is UNMAINTAINED is not graded β€” hex.pm publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: a Hex app name does not determine the modules it provides (`ecto_sql` provides Ecto.Adapters.SQL), and a large idiomatic class of BEAM dependencies β€” runtime adapters, codec plugins, protocol implementations and OTP applications the release starts β€” is correctly declared and never referenced in source, so absence of a reference is not evidence of an unused dependency. Known CVEs in this dependency graph are D30's question, read from mix.lock there.

Outdated: rustler_precompiled

βœ“ On the Gold path β€” maintain.

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

D13 Β· REDACTED Scanning0.0 / 10Criticalβœ“ Tool-verified

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 0.0 / 10 Β· rule-coverage 100% Β· ceiling Prevented

3 secret(s) detected.

REDACTED

What to do

  1. Resolve the 3 Leaked secret finding(s) in REDACTED Scanning β€” start with REDACTED, REDACTED, REDACTED. β€” One of this dimension's main actionable groups (3 issue-level).
  2. Enforce REDACTED Scanning in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D14 Β· License Compliance10.0 / 10Exemplaryβ—‹ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Verified

0 of 0 packages use a banned license. The depth of this set was not established for this repository: the graded packages are what this pass resolved, and no lockfile was read, so it is not certified to be the full transitive closure. β˜… COVERAGE OF THIS VERDICT: it grades this repository's NuGet package dependencies and nothing else. The repository also declares a Cargo manifest, a Python REDACTED/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, composer.json and package.json, and the licences of those dependency graphs were NOT read by this pass β€” a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

βœ“ On the Gold path β€” maintain.

Detailed fixes: d14_recommendation.md.

D15 Β· Churn × Complexity Hotspots9.3 / 10Stronggated by 217 serious findingsβœ“ Tool-verified

What it measures: Files that change often and are also complex β€” the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 9.3 / 10 Β· rule-coverage 100% Β· ceiling Documented

Top hotspots: crates/xberg/src/extractors/pdf/mod.rs (96×121=11616); crates/xberg/src/extractors/pdf/ocr/pipeline.rs (66×140=9240); crates/xberg/src/extraction/docx/parser.rs (43×184=7912) Repeated repair below the complexity floor: crates/xberg/src/core/config/ocr.rs (32 of 47 changes were fixes); crates/xberg/src/table_core.rs (26 of 35 changes were fixes); crates/xberg/src/pdf/render.rs (25 of 36 changes were fixes)

Repeated repair: crates/xberg/src/core/config/ocr.rs Β· Γ—120crates/xberg/src/core/config/ocr.rs:1146
Hotspot: crates/xberg/src/extractors/pdf/mod.rs Β· Γ—97crates/xberg/src/extractors/pdf/mod.rs:2250

What to do

  1. Resolve the 120 Repeated repair finding(s) in Churn × Complexity Hotspots β€” start with mod.rs (12), config.rs (3), ocr.rs (2). β€” One of this dimension's main actionable groups (120 warning-level).
  2. Resolve the 97 Hotspot finding(s) in Churn × Complexity Hotspots β€” start with mod.rs (10), parser.rs (9), pipeline.rs (2). β€” One of this dimension's main actionable groups (97 warning-level).

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

D17 Β· Explicit Debt10.0 / 10Adequategated by 1 critical findingβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Prevented

1 deducted debt markers + 0 dead symbols across 42162 LoC in the .NET projects (0.0/KLoC) β†’ score 10.0. Measured on the .NET source only: .rs (98% of production source) was not read, and carries at least 50 uncounted task marker(s) in 30 file(s).

NoWarnInCsprojpackages/csharp/Xberg.Runtime/Xberg.Runtime.csproj:28

What to do

  1. Resolve the 1 NoWarnInCsproj finding(s) in Explicit Debt β€” start with Xberg.Runtime.csproj. β€” One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Explicit Debt in CI to reach Verified (currently Documented). β€” Hardens enforcement from Documented toward Prevented β€” provenance only; does not change the score.

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

D20 Β· ADR Quality0.0 / 10Criticalβœ“ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 0.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. β€” One of this dimension's main actionable groups (1 recommendation-level).

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

D26 Β· Project Cohesion5.0 / 10Adequateβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 5.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

1 of 4 projects flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D28 Β· Secrets (history)0.0 / 10Criticalβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 0.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

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

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 74 REDACTED finding(s) in Secrets (history) β€” start with REDACTED (24), REDACTED (2), REDACTED. β€” One of this dimension's main actionable groups (74 issue-level).
  2. Resolve the 36 High secret finding(s) in Secrets (history) β€” start with REDACTED (36). β€” One of this dimension's main actionable groups (36 issue-level).
  3. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). β€” One of this dimension's main actionable groups (1 recommendation-level).

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

D29 Β· Static Analysis (SAST)0.0 / 10Criticalβœ“ Tool-verified

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

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 0.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

745 finding(s): 0 critical, 745 high, 0 medium, 0 low. 674 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 50 file(s) β€” `REDACTED`, `charts/xberg/templates/hpa.yaml`, `charts/xberg/templates/ingress.yaml`, `charts/xberg/templates/pdb.yaml`, `charts/xberg/templates/pvc.yaml`, … (+45 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 15 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

  1. Resolve the 28 REDACTED finding(s) in Static Analysis (SAST) β€” start with REDACTED (19), REDACTED (4), REDACTED (4). β€” One of this dimension's main actionable groups (28 issue-level).
  2. Resolve the 15 REDACTED finding(s) charged to Static Analysis (SAST) β€” the other 671 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. β€” One of this dimension's main actionable groups (686 issue-level, 15 of them charged here).
  3. Resolve the 13 REDACTED finding(s) in Static Analysis (SAST) β€” start with REDACTED (12), REDACTED. β€” One of this dimension's main actionable groups (13 issue-level).

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

D30 Β· Dependency Vulnerabilities0.0 / 10Criticalβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 0.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

25 finding(s): 5 critical, 11 high, 8 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

D31 Β· IaC & Container Security3.3 / 10Weakβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 3.3 / 10 Β· rule-coverage 100% Β· ceiling Documented

47 finding(s): 0 critical, 11 high, 28 medium, 8 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 28 Medium IaC finding(s) in IaC & Container Security β€” start with REDACTED (4), REDACTED (4), REDACTED (3). β€” One of this dimension's main actionable groups (28 warning-level).
  2. Resolve the 11 High IaC finding(s) in IaC & Container Security β€” start with REDACTED (2), REDACTED, REDACTED. β€” One of this dimension's main actionable groups (11 issue-level).
  3. Resolve the 8 Low IaC finding(s) in IaC & Container Security β€” start with REDACTED (8). β€” One of this dimension's main actionable groups (8 recommendation-level).

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

D34 Β· Knowledge Freshness10.0 / 10Exemplaryβœ“ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned β€” last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

3 of 1315 significant source file(s) are orphaned β€” their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/xberg-gliner/src/candle/heads/count_lstm.rs. Counted over 1315 of the 1537 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file Β· Γ—3crates/xberg-gliner/src/candle/heads/count_lstm.rs:1
Orphaned files with no living knowledge

βœ“ On the Gold path β€” maintain.

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

D35 Β· Change Coupling10.0 / 10Stronggated by 7 serious findingsβœ“ Tool-verified

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

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

Strongest change-coupling: output.rs↔runner.rs 68%; subprocess.rs↔output.rs 58%; extractor.rs↔markdown.rs 56%

Change coupling: output.rs ↔ runner.rs Β· Γ—7tools/benchmark-harness/src/output.rs:1

What to do

  1. Resolve the 7 Change coupling finding(s) in Change Coupling β€” start with subprocess.rs (2), output.rs, extractor.rs. β€” One of this dimension's main actionable groups (7 warning-level).

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

D36 Β· Supply-chain Provenance & Signing5.0 / 10Adequateβœ“ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity β€” generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals β€” generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions β€” scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 5.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

D37 Β· Vulnerability-disclosure Policy10.0 / 10Exemplaryβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

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

βœ“ On the Gold path β€” maintain.

Detailed fixes: d37_recommendation.md.

D40 Β· Network Egress Confinement6.0 / 10Adequateβœ“ Tool-verified

What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.

Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn β€” language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction β€” baseline misconfigs stay with D31). Deterministic.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 6.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

0/2 network-egress controls present (network policy, egress restriction).

No network policy

What to do

  1. Resolve the 1 No network policy finding(s) in Network Egress Confinement. β€” One of this dimension's main actionable groups (1 recommendation-level).

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

D41 Β· Kernel & Syscall Confinement6.0 / 10Adequateβœ“ Tool-verified

What it measures: Whether Kubernetes workloads confine the kernel boundary β€” a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer β€” shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.

Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 6.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

No workload manifest could be read as a pod spec, so no confinement was judged.

What to do

  1. Improve Kernel & Syscall Confinement β€” currently 6.0/10. β€” No workload manifest could be read as a pod spec, so no confinement was judged.

Detailed fixes: d41_recommendation.md.

D43 Β· Malicious Dependencies10.0 / 10Exemplaryβœ“ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable β€” a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it β€” a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

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

βœ“ On the Gold path β€” maintain.

Detailed fixes: d43_recommendation.md.

D44 Β· Platform End-of-Life10.0 / 10Exemplaryβœ“ Tool-verified

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

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

Maturity: Documented β†’ Verified β†’ Prevented Β· effective 10.0 / 10 Β· rule-coverage 100% Β· ceiling Documented

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

βœ“ On the Gold path β€” maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 Β· Code composition10.0 / 10Exemplaryβœ“ Tool-verified

Other Β· Architecture β€” How the codebase splits by code ROLE β€” domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER β€” domain, then infrastructure, then application β€” so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention β€” a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all β€” so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX3 Β· Project dependency cycles10.0 / 10Exemplaryβœ“ Tool-verified

Other Β· Architecture β€” Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 Β· Dependency direction10.0 / 10Exemplaryβœ“ Tool-verified

Other Β· Architecture β€” Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) β€” the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX5 Β· Architecture & structure10.0 / 10Exemplaryβœ“ Tool-verified

Other Β· Architecture β€” Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX6 Β· Interface segregation9.5 / 10Exemplaryβœ“ Tool-verified

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

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

  • `IOcrBackend` declares 17 members: `Name`, `Version`, `Initialize`, `Shutdown`, `ProcessImage`, `ProcessImageFile`, `SupportsLanguage`, `BackendType`, `SupportedLanguages`, `SupportedLanguagesFor`, `SupportsLanguageFor`, `SupportsTableDetection`, `SupportsDocumentProcessing`, `EmitsStructuredMarkdown`, `ConfidenceSemantics`, `PageOrientationHandling`, `ProcessDocument`. Counted as the author wrote them β€” a property is ONE member and its get/set accessors are not counted separately, and an event counts once. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. β€” packages/csharp/src/Xberg/TraitBridges.cs:18

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX9 Β· CQS / query purity10.0 / 10Exemplaryβœ“ Tool-verified

Other Β· Architecture β€” Whether read (query) handlers stay side-effect-free β€” a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set β€” a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

C1 Β· Data Protection0.0 / 10Criticalβœ“ Tool-verified

Other Β· Security β€” Whether sensitive data is encrypted at rest and in transit and keys are vaulted.

Method: Roslyn plus filesystem scan: encryption presence (EF ColumnEncryption, key-vault references, HTTPS enforcement) and key-derivation KDF detection. Deterministic.

  • No data-protection or encryption usage (ASP.NET Data Protection, AES, column encryption, PBKDF2) was found β€” sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore.

What to do

  • Encrypt sensitive data at rest (ASP.NET Core Data Protection / column encryption) and manage keys in a vault. Skip if delegated to infra (Postgres TDE, KMS, etc.).
  • Enforce HTTPS (UseHttpsRedirection / RequireHttpsMetadata) so data in transit is always encrypted.
C4 Β· Data Retention6.5 / 10Adequateβœ“ Tool-verified

Other Β· Security β€” Whether data has a defined lifetime β€” retention periods, TTLs, cleanup jobs (storage limitation).

Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.

  • A retention mechanism is present, but the data-lifecycle is not yet complete β€” missing: a scheduled purge / cleanup job (PurgeOlderThan / CleanupJob), a documented retention period / data-expiry.

What to do

  • Complete the data-lifecycle story: an expiry limit (a declared maximum age for the stored data β€” a retention-age setting, or a store-level TTL where your storage offers one), a scheduled purge/cleanup job that enforces it, and a documented retention period covering the personal data.
GD1 Β· Unfinished & placeholder code10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

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

IC1 Β· Incompleteness & stubs10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Unfinished work detected by code SHAPE, not keywords: members that only throw a "not implemented" exception, methods that take inputs and return a constant, async methods that never await, dead `if (false)` / `#if false` branches, and skeleton types most of whose members are holes. A real, objective slice of technical debt.

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

M1 Β· Documentation (README)7.3 / 10Strongβœ“ Tool-verified

Maturity Β· Maturity β€” Whether the repo and its projects have a README, and whether it's substantive and current.

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

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add a README to the 4 of 4 project(s) that lack one β€” worth up to 2 pts.
M2 Β· Architecture documentation5.0 / 10Adequateβœ“ Tool-verified

Maturity Β· Maturity β€” Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found β€” no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 Β· Folder & project structure10.0 / 10Exemplaryβœ“ Tool-verified

Maturity Β· Maturity β€” Whether the repo is organised deliberately β€” src/test separation and consistent project naming.

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

M4 Β· Documentation accuracy10.0 / 10Exemplaryβ—‹ Nothing flagged

Maturity Β· Maturity β€” Whether the README actually describes the code that exists (LLM-judged, advisory).

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

P1 Β· CI/CD gates10.0 / 10Exemplaryβ—‹ Nothing flagged

Readiness Β· Readiness β€” Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 Β· Library API & versioning6.0 / 10Adequateβœ“ Tool-verified

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

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language 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.

  • 573/743 types (77%) are public. For a library, every public type is a stability contract β€” make internal-by-default and expose only the intended API.

What to do

  • Make types internal by default; expose only the deliberate public API so internals can change without breaking consumers.
P3 Β· Security & performance tooling7.0 / 10Strongβœ“ Tool-verified

Readiness Β· Readiness β€” Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step β€” in this repository's own ecosystem. Exhaustive, deterministic.

  • `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) β€” the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.

What to do

  • Trigger your SAST workflow on pull requests β€” a scan that only runs on a cron reports history, it does not gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 Β· Deployment & Rollback10.0 / 10Exemplaryβœ“ Tool-verified

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

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

P5 Β· DR & Backup7.0 / 10Strongβœ“ Tool-verified

Readiness Β· Readiness β€” Whether disaster recovery is planned and codified β€” backups, geo-recovery, RTO/RPO, persistence guarantees β€” from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
P6 Β· Release Hygiene10.0 / 10Exemplaryβœ“ Tool-verified

Readiness Β· Readiness β€” Whether releases are traceable β€” a maintained changelog and explicit version stamping.

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

PF1 Β· Benchmark discipline8.0 / 10Strongβœ“ Tool-verified

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

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

PF2 Β· Allocation hygiene6.0 / 10Adequateβœ“ Tool-verified

Readiness Β· Performance β€” Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager β€” buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.

Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs β€” in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.

  • No Span/Memory, pooling (ArrayPool/ObjectPool), stackalloc, ValueTask or buffer-writer usage was found. If this code sits on a hot path, these reduce the GC pressure it creates β€” a bonus, not a requirement.

What to do

  • On hot paths, prefer Span<T>/ReadOnlySpan<T>, ArrayPool<T>, stackalloc and ValueTask to cut the allocations those paths would otherwise make.
PF3 Β· Async & latency hygiene6.0 / 10Adequateβœ“ Tool-verified

Readiness Β· Performance β€” Whether asynchronous code stays responsive β€” it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere β€” .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect β€” and, for a .NET library with β‰₯5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • Only 0/6 awaits in library code use ConfigureAwait(false). A library that captures the caller's context can stall or deadlock its host β€” the classic way a dependency drags an app down.
  • `await Task.Run(() => { var nativeResult = NativeMethods.ClassifyChunksOwned( result...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:55
  • `await Task.Run(() => { var nativeResult = NativeMethods.Extract( inputHandle, confi...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:142
  • `await Task.Run(() => { var nativeResult = NativeMethods.ExtractBatch( inputsHandle,...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:185
  • `await Task.Run(() => { var nativeResult = NativeMethods.ExtractWithExternalRedactio...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:241
  • `await Task.Run(() => { var nativeResult = NativeMethods.MapUrl( uri, configHandle )...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:579
  • `await Task.Run(() => { var nativeResult = NativeMethods.RedactExternal( documentHan...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`. β€” packages/csharp/src/Xberg/XbergConverter.cs:835

What to do

  • In library code, append .ConfigureAwait(false) to every await (or set <ConfigureAwait>false</ConfigureAwait> / use the analyzer CA2007) so the library never captures the host's context.
R1 Β· Type Safety6.7 / 10Adequateβœ“ 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.

  • 14 typed · 7 plain JS β€” the untyped files are cli-proxy/npm/install.js, cli-proxy/npm/test.mjs, integrations/node/n8n-nodes-xberg/index.js, scripts/ci/smoke_test_node_binding.js, scripts/publish/node/smoke-glibc-2-28.mjs, scripts/task/patch-demo-dev.mjs (+1 more).

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 Β· Code Duplication9.0 / 10Strongβœ“ Tool-verified

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

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

  • cli-proxy/npm/install.js:209 · cli-proxy/npm/install.js:244 β€” the two spans are one implementation copied and then locally edited β€” 158 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. β€” cli-proxy/npm/install.js:209
  • integrations/node/llamaindex-xberg/src/nodeParser.ts:84 · integrations/node/llamaindex-xberg/src/nodeParser.ts:111 β€” 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. β€” integrations/node/llamaindex-xberg/src/nodeParser.ts:84
  • integrations/node/llamaindex-xberg/src/readerMapping.ts:479 · integrations/node/llamaindex-xberg/src/readerMapping.ts:499 β€” the two spans are one implementation copied and then locally edited β€” 87 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. β€” integrations/node/llamaindex-xberg/src/readerMapping.ts:479
  • integrations/node/langchain-xberg/src/mapping.ts:130 · integrations/node/llamaindex-xberg/src/readerMapping.ts:373 β€” 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. β€” integrations/node/langchain-xberg/src/mapping.ts:130
  • integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:208 · integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:320 β€” 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. β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:208
  • integrations/node/langchain-xberg/src/mapping.ts:159 · integrations/node/langchain-xberg/src/mapping.ts:189 β€” 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. β€” integrations/node/langchain-xberg/src/mapping.ts:159

What to do

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

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

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

  • buildMetadata has cyclomatic complexity 18 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. β€” integrations/node/llamaindex-xberg/src/readerMapping.ts:341
  • documentToJson has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth β€” arms side by side rather than stacked β€” and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:116
  • runExtractBatch has cyclomatic complexity 11 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side β€” extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:259
  • resultsToDocuments has cyclomatic complexity 11 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 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. β€” integrations/node/llamaindex-xberg/src/readerMapping.ts:470
  • buildMetadata has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth β€” arms side by side rather than stacked β€” and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. β€” integrations/node/langchain-xberg/src/mapping.ts:119

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≀ 5.
R3 Β· Large Files7.6 / 10Strongβœ“ Tool-verified

React / JS Β· Code Health β€” How many source files exceed the large-file threshold.

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

  • integrations/node/llamaindex-xberg/src/readerMapping.ts has 466 significant lines (blank lines excluded), over the 400-line bar, and contains logic β€” a file this long is usually several responsibilities in one module. β€” integrations/node/llamaindex-xberg/src/readerMapping.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 Β· Test Coverage3.9 / 10Weakβœ“ 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. (×8) β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:1, integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.ts:1, integrations/node/langchain-xberg/src/loader.ts:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 Β· Dependency Freshness10.0 / 10Exemplaryβœ“ Tool-verified

React / JS Β· Readiness β€” How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

R6 Β· Tooling10.0 / 10Exemplaryβœ“ Tool-verified

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

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

R7 Β· Dead Code8.3 / 10Strongβœ“ 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.

  • 1 file(s) (~59 LoC) were excluded from dead-code analysis. This package DOES declare main/module/exports β€” but every declared target is missing from the scanned tree, which is what a build-output entry (dist/, lib/, out/) looks like before the package is built. Point a declared target at the source entry, or build the package before scanning, so reachability can follow it. β€” crates/xberg-node
  • 1 file(s) (~176 LoC) were excluded from dead-code analysis. This package DOES declare main/module/exports β€” but every declared target is missing from the scanned tree, which is what a build-output entry (dist/, lib/, out/) looks like before the package is built. Point a declared target at the source entry, or build the package before scanning, so reachability can follow it. β€” crates/xberg-wasm
  • 2 file(s) (~361 LoC) were excluded from dead-code analysis β€” declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package. β€” docs-site
  • Unreachable from the 5 application, 10 tooling and 49 test entry point(s) detected in this repo. Gate removals on `pnpm run typecheck` β€” an undetected custom entry would make these reachable.
  • no import path from any entry point (5 application, 10 tooling, 49 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 (×2) β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts, scripts/publish/node/smoke-glibc-2-28.mjs
  • no import path from any entry point (5 application, 10 tooling, 49 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.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 β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.ts
  • no import path from any entry point (5 application, 10 tooling, 49 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.ts, integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.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 β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.constants.ts

What to do

  • Delete the dead files and unused exports β€” every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 Β· Dependency Hygiene2.5 / 10Weakβœ“ Tool-verified

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

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

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

What to do

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

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

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

S1 Β· Cryptographic Hygiene8.0 / 10Strongβœ“ Tool-verified

Other Β· Security β€” Cryptographic hygiene (weak hash/cipher, password key-derivation). This codebase has no web surface, so transport/header/cookie/CSRF controls are N/A and only crypto is scored. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself β€” a page handed to a consumer runs in that consumer's origin.

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.

  • `https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request β€” the CDN, anyone who compromises it, anyone on the network path β€” runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time β€” the executed bytes can change with nobody touching this repository. β€” docs-site/public/demo.html:29

What to do

  • Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required β€” an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
X1 Β· Async correctness10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 Β· Unreachable branch10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X13 Β· Undrained process stream10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X14 Β· Bypassable address classification10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X15 Β· Unvalidated length from an untrusted reader10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X16 Β· Unfloored truncation loop10.0 / 10Exemplaryβ—‹ Nothing flagged

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

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything β€” a direct comparison on the length, a body guard, a break β€” bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression β€” never compared directly, never tested for truthiness, and with no other read of `x` β€” and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 Β· Uncapped recursion over a caller-supplied document10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X18 Β· Disposal-pattern correctness10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X19 Β· Unrestored process-global state10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X2 Β· Cancellation propagation4.0 / 10Weakβœ“ Tool-verified

Other Β· Code Health β€” Whether async methods accept a CancellationToken so work can be cancelled (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. 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 question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 0/6 async methods accept a CancellationToken, so in-flight work can't be stopped early when the caller gives up β€” whatever ends it in your host (shutdown signal, timeout, abandoned request, user cancel). Thread a token through the call chain and honour it at each await and loop; where a method genuinely cannot be interrupted, omitting it is a deliberate choice β€” judge against your hosting model.
  • No CancellationToken parameter β€” this work can't be stopped early once started. (×6) β€” packages/csharp/src/Xberg/XbergConverter.cs:37, packages/csharp/src/Xberg/XbergConverter.cs:124, packages/csharp/src/Xberg/XbergConverter.cs:172, …

What to do

  • Thread a CancellationToken through async methods so work stops promptly on cancellation.
X20 Β· Mistyped argument guard10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether an argument guard throws the exception its own condition describes β€” a guard that rejects a value for being EMPTY and reports it as `ArgumentNullException` tells the caller a parameter was null when it provably was not.

Method: Roslyn syntax: `throw new ArgumentNullException(nameof(p))` statements controlled by an `if`, whose condition is read for a test that is true of a NON-null `p` β€” an emptiness test that dereferences it (`p.Count == 0`, `!p.Any()`) or a BCL predicate documented true of the empty value (`string.IsNullOrEmpty(p)`). Deterministic, provable per finding. Advisory.

X21 Β· Side-effecting pattern guard10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a `when` guard is free of side effects β€” a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X22 Β· Contradicted release guard10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X23 Β· Unguarded diagnostic materialisation10.0 / 10Exemplaryβ—‹ Nothing flagged

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

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence β€” a LINQ operator, a materialisation, `string.Join`, a serializer β€” with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` β€” outside any arrow or function passed as an argument, which the logger calls only when the level is on β€” with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 Β· Document value interpolated into markup unescaped10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X25 Β· Inert configuration knob10.0 / 10Exemplaryβ—‹ Nothing flagged

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

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

X26 Β· Unsynchronised callback handoff10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed β€” a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it β€” and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 Β· Collection changed while being enumerated10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a `foreach` leaves the collection it is walking alone β€” a body that adds to or removes from the very collection the loop is enumerating invalidates the enumerator it is holding, so the next `MoveNext` throws `InvalidOperationException` and the remaining items are never seen.

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

X28 Β· Index access outside its own emptiness guard10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a condition that tests a value for emptiness indexes that same value only where the test holds β€” an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty β€” a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 Β· Per-element action decided by a fixed element10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a decision taken once per element is taken ABOUT that element β€” a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move β€” written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 Β· Exception handling5.5 / 10Adequateβœ“ Tool-verified

Other Β· Code Health β€” Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

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

  • `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch. (×6) β€” packages/csharp/src/Xberg/MetaSchema.cs:202, packages/csharp/src/Xberg/MetaSchema.cs:219, packages/csharp/src/Xberg/Registry.cs:203, …
  • `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch. (×9) β€” packages/csharp/src/Xberg/TraitBridges.cs:424, packages/csharp/src/Xberg/TraitBridges.cs:479, packages/csharp/src/Xberg/TraitBridges.cs:557, …
  • An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×25) β€” packages/csharp/src/Xberg/TraitBridges.cs:430, packages/csharp/src/Xberg/TraitBridges.cs:436, packages/csharp/src/Xberg/TraitBridges.cs:485, …

What to do

  • Swallowed exception (caught, then discarded)
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.

X32 Β· Type resolved by simple name across every loaded assembly10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether a plugin lookup names the type it means β€” searching every assembly loaded into the process for a candidate whose SIMPLE name equals a string supplied at runtime, and taking the first one found, is decided by assembly LOAD ORDER rather than by this source, so the same name can resolve to a different type on the next run.

Method: Roslyn syntax only, no semantic model: every invocation of `First`/`FirstOrDefault`/`Single`/`SingleOrDefault` whose OWN expression subtree contains both a `GetAssemblies()` call and a `GetTypes()`/`GetExportedTypes()` call β€” a single-element pick out of every type loaded into the process. A nested selector in the same chain sees no `GetAssemblies()` in its own subtree and is outside the population, so one lookup counts once however many links its chain has. A finding additionally needs both remaining halves: the selector must be `First`/`FirstOrDefault` (`Single`/`SingleOrDefault` reports the ambiguity rather than resolving it, and is counted and never reported), and the chain must carry an `==` comparison of `<lambda parameter>.Name` against something that is not a literal. The receiver must be a plain identifier bound by one of the chain’s own lambdas, which places `assembly.GetName().Name == "X"` outside the rule by construction. One exemption: a `.Name` test joined by `&&` to a `FullName`/`AssemblyQualifiedName` test on the same identifier is spared; joined by `||` it is not. Deterministic, provable per finding. Advisory.

X4 Β· Structured logging10.0 / 10Exemplaryβ—‹ Nothing flagged

Other Β· Code Health β€” Whether log calls use message templates (queryable) rather than interpolated strings.

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

X5 Β· Nullable reference types8.8 / 10Strongβœ“ Tool-verified

Other Β· Code Health β€” Whether nullable reference types are enabled and not undermined by heavy `!` suppression.

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

  • ~1.5 `!` suppressions per 1k syntax nodes β€” 199 suppression(s) across the 135385 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide.

What to do

  • Enable <Nullable>enable</Nullable> across all projects and resolve warnings rather than suppressing with `!`.

Reference β€” by lens

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

LensScoreRatingImpact
Code Health62%Adequate β€” gated by D2Capped at Fair by a Critical contributor β€” resolve it before relying on this lens.
Architecture93%ExemplaryStrongest area.
Maturity76%StrongSolid.
Readiness53%Adequate β€” gated by D13, R4, R8Capped at Fair by a Critical contributor β€” resolve it before relying on this lens.
Security40%Weak β€” gated by D28, D29, D30, D31, C1Capped at Fair by a Critical contributor β€” resolve it before relying on this lens.
Performance65%AdequateAcceptable, with room to improve.
Unscored β€” 5 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.

  • P12 CI test-gate honesty β€” 1 observation(s) recorded Β· Reported, not scored β€” this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • SC1 Supply-chain hygiene β€” 1 observation(s) recorded Β· Advisory β€” this card reports evidence and never carries a score, so there is nothing missing here.
  • X10 Duplicated predicate β€” 25 observation(s) recorded Β· Advisory β€” this card reports evidence and never carries a score.
  • X7 Silent fallback defaults β€” 40 observation(s) recorded Β· Advisory β€” this card reports evidence and never carries a score.
  • X9 Subsumed condition operand β€” 25 observation(s) recorded Β· Advisory β€” this card reports evidence and never carries a score.
Not evidenced β€” 2 control(s) we could not find positive evidence for

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

  • C3 Audit Trail β€” Repo shows no audit-logging mechanism (IAuditable, an immutable audit log, an EF SaveChanges interceptor) for sensitive changes β€” absence of evidence is not evidence of a working control. Record an audit trail in code (or document where it lives) so this dimension can be scored.
  • C5 Data-Subject Rights β€” Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary β€” absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
Not included β€” 41 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 user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC2 Forms & labels β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC3 Page structure β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC4 Keyboard semantics β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC5 ARIA correctness β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC6 Visual & motion safety β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AC7 A11y enforcement β€” No user-facing web UI (the repo is a library/CLI/worker/headless service) β€” accessibility is not applicable.
  • AX1 Captive dependencies β€” no DI registrations detected
  • AX2 Stateful singletons β€” no singleton implementations detected
  • AX7 Slice cohesion β€” not applicable β€” not a vertical-slice architecture
  • AX8 Test isolation β€” no test/production split to check
  • AXB2 Runtime readiness β€” Advisory β€” this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility β€” docker build failed (exit 1) β€” 109 | 110 | >>> FROM debian:trixie-slim 111 | 112 | LABEL org.opencontainers.image.source="https://github.com/xberg-io/xberg" -------------------- ERROR: failed to solve: debian:trixie-slim: failed to resolve source metadata for docker.io/library/debian:trixie-slim: failed to do request: Head "https://registry-1.docker.io/v2/library/debian/manifests/trixie-slim": Forbidden; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C2 Access Controls β€” No access-control surface detected in the analyzed source β€” no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here β€” this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • D11 Test Reliability β€” Test reliability not measured β€” polyglot suite, one half not re-run
  • D16 Bus Factor β€” single-maintainer repository β€” bus factor is not applicable
  • D18 Solution Shape β€” D18 scores the shape of a .NET solution, but this repository's production source is mostly .c, .cpp, .exs, .java, .php, .py, .rb, .rs, .swift, .ts β€” the .NET project files present are an immaterial minority β€” so the dimension does not apply.
  • D19 Documentation Quality β€” D19 reads .NET projects as units only; 32 folder(s) declared by Cargo.toml, composer.json, package.json, pom.xml, REDACTED were not judged for an overview, an example or the map.
  • D21 Naming Consistency β€” Naming consistency is measured on C# only; Dart, Elixir, Go, Java, JavaScript, Kotlin, PHP, Python, Ruby, Rust, Swift, TypeScript, html not measured.
  • D22 Internal API Consistency β€” API consistency is measured on C# only; the exposed Kotlin, Ruby, Rust, Swift surface was not measured.
  • D23 Boundary Type-Coupling β€” Cross-context type coupling could not be assessed β€” this codebase's bounded contexts are neither declared nor inferable.
  • D24 Comment Value β€” D24 reads C# and Visual Basic comments only; comments in this repository's .exs, .java, .php, .py, .rb, .rs, .swift, .ts source were not judged.
  • D25 ADR Conformance β€” no ADRs to check
  • D27 Navigability β€” D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) β€” 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.
  • D39 IL Efficiency β€” IL not measured β€” the analyzer's build of the target did not succeed
  • D42 Runtime Threat Enforcement β€” The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart β€” nothing for this repo to assess.
  • D7 Architectural Integrity β€” no checkable ADRs and no dependency cycles β€” architectural integrity not assessed
  • D8 Code Coverage β€” Coverage NOT MEASURED: the .NET half could not be measured β€” the repository wires up no coverage collector for `--collect:"XPlat Code Coverage"` to use; the JavaScript/TypeScript half could not be measured β€” the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
  • DM1 Domain Modelling β€” applicable but not scored (2 signals for this style, 2 needed β€” the count is met but a required primary signal is absent): 1544 value object(s); 1 domain event(s); its domain events are published by services or handlers β€” no domain entity raises one
  • ED2 Event/command shape β€” not scored β€” deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • ED2 Event/command shape β€” not scored β€” deciding whether a command has more than one competing handler requires resolving the call graph, which this analysis does not build from source alone for this language. Reported as guidance rather than measured
  • 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 none of the 3 signals this lens looks for
  • P2 Observability β€” This repo is a library, not a deployed service β€” it has no process to operate, so production observability (structured logging, tracing/metrics, health checks) is N/A. A library may log via an injected ILogger, but the absence of operational telemetry is not a defect here. If it grows a host (web API, worker), the dimension reactivates.
  • P7 Outbound HTTP resilience β€” not applicable β€” this isn't a service/API/worker
  • P8 Schema migrations β€” no EF Core usage detected
  • P9 Domain vs controller coverage β€” no coverage report found on disk β€” produce a coverage report in a standard format (lcov β€” `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it β€” a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • R11 Import Boundaries β€” No recognizable feature-sliced/layered src layout β€” boundary rules not applicable.
  • X6 Hand-rolled structured-format parsing β€” Advisory β€” this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A β€” Findings (grouped)

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

Critical β€” 886 finding(s)
D29 Β· Static Analysis (SAST) Β· REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 661 more in this group β€” see findings.md.
D28 Β· Secrets (history) Β· REDACTED Β· Γ—74
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 49 more in this group β€” see findings.md.
D28 Β· Secrets (history) Β· High secret Β· Γ—36
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 11 more in this group β€” see findings.md.
D29 Β· Static Analysis (SAST) Β· REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 3 more in this group β€” see findings.md.
D29 Β· Static Analysis (SAST) Β· REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 Β· IaC & Container Security Β· High IaC Β· Γ—11
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 Β· Dependency Vulnerabilities Β· High CVE Β· Γ—10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D13 Β· REDACTED Scanning Β· Leaked secret Β· Γ—3
  • REDACTED
  • REDACTED
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 Β· Dependency Vulnerabilities Β· Critical CVE Β· Γ—3
  • REDACTED
  • REDACTED
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—2
  • REDACTED
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—2
  • REDACTED
  • REDACTED
D30 Β· Dependency Vulnerabilities Β· Critical vulnerability Β· Γ—2
  • REDACTED
  • REDACTED
D17 Β· Explicit Debt Β· NoWarnInCsproj Β· Γ—1
  • NoWarnInCsproj packages/csharp/Xberg.Runtime/Xberg.Runtime.csproj:28 β€” NU5128 β€” this warning is switched off for the WHOLE project, including builds years from now. It is raised by the build itself β€” the packaging, restore or SDK step β€” about the project as a whole, not by the compiler or an analyzer at a line of code, so there is no call site to narrow it to and no per-site directive that could carry a reason: this element is the only place the decision can be recorded. Say WHY here, in a comment on the entry, or fix what the rule is reporting and drop the code from the list.
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—1
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—1
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—1
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—1
  • REDACTED
D29 Β· Static Analysis (SAST) Β· REDACTED Β· Γ—1
  • REDACTED
D30 Β· Dependency Vulnerabilities Β· High vulnerability Β· Γ—1
  • REDACTED
Serious β€” 2599 finding(s)
D2 Β· Cognitive Complexity Β· xberg Β· Γ—241
  • xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page (cognitive 327) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310 β€” xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page has cognitive complexity 327 (threshold 15). Drivers by points: if/else 109 (249 pts), boolean chains 33, loops 15 (33 pts), match/switch 5 (12 pts) (nesting depth added 165). 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.
  • xberg::extractors::docx::build_internal_document (cognitive 259) crates/xberg/src/extractors/docx.rs:88 β€” xberg::extractors::docx::build_internal_document has cognitive complexity 259 (threshold 15). Drivers by points: if/else 52 (159 pts), loops 23 (83 pts), match/switch 4 (10 pts), boolean chains 7 (nesting depth added 173). 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.
  • xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs (cognitive 220) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:611 β€” xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs has cognitive complexity 220 (threshold 15). Drivers by points: if/else 66 (154 pts), loops 18 (42 pts), match/switch 8 (21 pts), boolean chains 3 (nesting depth added 125). 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.
  • xberg::pdf::table_reconstruct::post_process_table_inner (cognitive 202) crates/xberg/src/pdf/table_reconstruct.rs:494 β€” xberg::pdf::table_reconstruct::post_process_table_inner has cognitive complexity 202 (threshold 15). Drivers by points: if/else 75 (144 pts), boolean chains 34, loops 13 (24 pts) (nesting depth added 80). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::jats::elements::extract_jats_all_in_one (cognitive 175) crates/xberg/src/extractors/jats/elements.rs:15 β€” xberg::extractors::jats::elements::extract_jats_all_in_one has cognitive complexity 175 (threshold 15). Drivers by points: if/else 34 (128 pts), loops 6 (21 pts), match/switch 5 (17 pts), boolean chains 9 (nesting depth added 121). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::pdf::structure::pipeline::build_document_structure (cognitive 162) crates/xberg/src/pdf/structure/pipeline.rs:3354 β€” xberg::pdf::structure::pipeline::build_document_structure has cognitive complexity 162 (threshold 15). Drivers by points: if/else 50 (133 pts), loops 9 (18 pts), match/switch 2 (9 pts), boolean chains 2 (nesting depth added 99). 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.
  • xberg::extractors::odt::build_internal_elements (cognitive 160) crates/xberg/src/extractors/odt.rs:754 β€” xberg::extractors::odt::build_internal_elements has cognitive complexity 160 (threshold 15). Drivers by points: if/else 25 (107 pts), loops 13 (45 pts), match/switch 2 (7 pts), boolean chains 1 (nesting depth added 119). 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.
  • xberg::rendering::comrak_bridge::build_comrak_ast (cognitive 158) crates/xberg/src/rendering/comrak_bridge.rs:883 β€” xberg::rendering::comrak_bridge::build_comrak_ast has cognitive complexity 158 (threshold 15). Drivers by points: if/else 44 (112 pts), match/switch 9 (29 pts), boolean chains 9, loops 5 (8 pts) (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::docbook::parse_docbook_single_pass (cognitive 147) crates/xberg/src/extractors/docbook.rs:530 β€” xberg::extractors::docbook::parse_docbook_single_pass has cognitive complexity 147 (threshold 15). Drivers by points: if/else 33 (127 pts), boolean chains 8, match/switch 3 (8 pts), loops 2 (4 pts) (nesting depth added 101). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::jats::build_jats_internal_document (cognitive 145) crates/xberg/src/extractors/jats/mod.rs:231 β€” xberg::extractors::jats::build_jats_internal_document has cognitive complexity 145 (threshold 15). Drivers by points: if/else 23 (97 pts), loops 6 (22 pts), match/switch 5 (17 pts), boolean chains 9 (nesting depth added 102). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::ocr::processor::execution::perform_ocr (cognitive 118) crates/xberg/src/ocr/processor/execution.rs:1799 β€” xberg::ocr::processor::execution::perform_ocr has cognitive complexity 118 (threshold 15). Drivers by points: if/else 50 (86 pts), match/switch 12 (21 pts), boolean chains 9, loops 1 (2 pts) (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.
  • xberg::extractors::docbook::extract_para_with_annotations (cognitive 114) crates/xberg/src/extractors/docbook.rs:1121 β€” xberg::extractors::docbook::extract_para_with_annotations has cognitive complexity 114 (threshold 15). Drivers by points: if/else 20 (70 pts), loops 8 (28 pts), match/switch 3 (10 pts), boolean chains 6 (nesting depth added 77). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::docbook::extract_element_text_with_inline (cognitive 109) crates/xberg/src/extractors/docbook.rs:865 β€” xberg::extractors::docbook::extract_element_text_with_inline has cognitive complexity 109 (threshold 15). Drivers by points: if/else 20 (65 pts), loops 7 (28 pts), match/switch 3 (10 pts), boolean chains 6 (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::pdf::structure::classify::classify_paragraphs (cognitive 109) crates/xberg/src/pdf/structure/classify.rs:91 β€” xberg::pdf::structure::classify::classify_paragraphs has cognitive complexity 109 (threshold 15). Drivers by points: if/else 41 (77 pts), boolean chains 29, loops 3 (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.
  • xberg::extractors::docbook::build_docbook_internal_document (cognitive 101) crates/xberg/src/extractors/docbook.rs:253 β€” xberg::extractors::docbook::build_docbook_internal_document has cognitive complexity 101 (threshold 15). Drivers by points: if/else 19 (76 pts), loops 4 (13 pts), match/switch 3 (8 pts), boolean chains 4 (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::core::pipeline::features::execute_chunking (cognitive 98) crates/xberg/src/core/pipeline/features.rs:410 β€” xberg::core::pipeline::features::execute_chunking has cognitive complexity 98 (threshold 15). Drivers by points: if/else 28 (74 pts), boolean chains 11, loops 2 (8 pts), match/switch 2 (5 pts) (nesting depth added 55). 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.
  • xberg::rendering::djot::render_djot (cognitive 92) crates/xberg/src/rendering/djot.rs:16 β€” xberg::rendering::djot::render_djot has cognitive complexity 92 (threshold 15). Drivers by points: if/else 28 (68 pts), match/switch 4 (12 pts), loops 5 (8 pts), boolean chains 4 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::jats::parser::extract_citation_text (cognitive 88) crates/xberg/src/extractors/jats/parser.rs:108 β€” xberg::extractors::jats::parser::extract_citation_text has cognitive complexity 88 (threshold 15). Drivers by points: if/else 28 (67 pts), match/switch 4 (13 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::extractors::hwpx::build_hwpx_internal_document (cognitive 83) crates/xberg/src/extractors/hwpx.rs:221 β€” xberg::extractors::hwpx::build_hwpx_internal_document has cognitive complexity 83 (threshold 15). Drivers by points: if/else 19 (46 pts), loops 7 (24 pts), match/switch 2 (9 pts), boolean chains 4 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::ocr::hocr_parser::parse_paragraph (cognitive 81) crates/xberg/src/ocr/hocr_parser.rs:675 β€” xberg::ocr::hocr_parser::parse_paragraph has cognitive complexity 81 (threshold 15). Drivers by points: if/else 42 (74 pts), boolean chains 4, loops 3 (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.
  • xberg::extractors::latex::commands::process_command (cognitive 74) crates/xberg/src/extractors/latex/commands.rs:47 β€” xberg::extractors::latex::commands::process_command has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (58 pts), loops 4 (11 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 40). 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.
  • xberg::extraction::ppt::extract_texts_from_records (cognitive 69) crates/xberg/src/extraction/ppt/mod.rs:659 β€” xberg::extraction::ppt::extract_texts_from_records has cognitive complexity 69 (threshold 15). Drivers by points: if/else 22 (51 pts), match/switch 3 (9 pts), boolean chains 6, loops 3 (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.
  • xberg::extractors::pdf::extraction::extract_all_from_native_document (cognitive 63) crates/xberg/src/extractors/pdf/extraction.rs:482 β€” xberg::extractors::pdf::extraction::extract_all_from_native_document has cognitive complexity 63 (threshold 15). Drivers by points: if/else 22 (36 pts), match/switch 5 (11 pts), boolean chains 10, loops 2 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::pdf::structure::pipeline::deduplicate_overlapping_tables (cognitive 61) crates/xberg/src/pdf/structure/pipeline.rs:4840 β€” xberg::pdf::structure::pipeline::deduplicate_overlapping_tables has cognitive complexity 61 (threshold 15). Drivers by points: if/else 13 (43 pts), match/switch 2 (11 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg::pdf::table_reconstruct::is_well_formed_table_core (cognitive 60) crates/xberg/src/pdf/table_reconstruct.rs:2119 β€” xberg::pdf::table_reconstruct::is_well_formed_table_core has cognitive complexity 60 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 12, loops 4 (11 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 216 more in this group β€” see findings.md.
D2 Β· Cognitive Complexity Β· xberg_native_pdf Β· Γ—122
  • xberg_native_pdf::rendering::separation_renderer::execute_separation_operators (cognitive 138) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1489 β€” xberg_native_pdf::rendering::separation_renderer::execute_separation_operators has cognitive complexity 138 (threshold 15). Drivers by points: if/else 46 (125 pts), match/switch 5 (10 pts), boolean chains 2, loops 1 (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::functions::execute (cognitive 86) crates/xberg-native-pdf/src/functions/mod.rs:546 β€” xberg_native_pdf::functions::execute has cognitive complexity 86 (threshold 15). Drivers by points: if/else 25 (64 pts), match/switch 6 (13 pts), boolean chains 8, loops 1 (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.
  • xberg_native_pdf::content::parser::forward_scan_ctm (cognitive 79) crates/xberg-native-pdf/src/content/parser.rs:691 β€” xberg_native_pdf::content::parser::forward_scan_ctm has cognitive complexity 79 (threshold 15). Drivers by points: if/else 17 (41 pts), loops 8 (19 pts), boolean chains 12, match/switch 2 (7 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::extractors::text::should_insert_space (cognitive 79) crates/xberg-native-pdf/src/extractors/text/mod.rs:1170 β€” xberg_native_pdf::extractors::text::should_insert_space has cognitive complexity 79 (threshold 15). Drivers by points: if/else 37 (57 pts), boolean chains 22 (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.
  • xberg_native_pdf::content::parser::parse_text_operator_fast (cognitive 75) crates/xberg-native-pdf/src/content/parser.rs:4064 β€” xberg_native_pdf::content::parser::parse_text_operator_fast has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (46 pts), match/switch 4 (13 pts), boolean chains 10, loops 3 (6 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::content::parser::scan_graphics_region (cognitive 75) crates/xberg-native-pdf/src/content/parser.rs:4256 β€” xberg_native_pdf::content::parser::scan_graphics_region has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (41 pts), match/switch 5 (16 pts), boolean chains 9, loops 4 (9 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.
  • xberg_native_pdf::extractors::images::extract_image_from_xobject (cognitive 73) crates/xberg-native-pdf/src/extractors/images.rs:1385 β€” xberg_native_pdf::extractors::images::extract_image_from_xobject has cognitive complexity 73 (threshold 15). Drivers by points: if/else 34 (55 pts), boolean chains 10, match/switch 3 (8 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::structure::spatial_table_detector::detect_tables_in_cluster (cognitive 73) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:1781 β€” xberg_native_pdf::structure::spatial_table_detector::detect_tables_in_cluster has cognitive complexity 73 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 8 (25 pts), boolean chains 9 (nesting depth added 39). 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.
  • xberg_native_pdf::structure::spatial_table_detector::split_rows_by_text_positions (cognitive 67) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2764 β€” xberg_native_pdf::structure::spatial_table_detector::split_rows_by_text_positions has cognitive complexity 67 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 12 (29 pts), boolean chains 2 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::content::parser::parse_content_stream_paths_only (cognitive 66) crates/xberg-native-pdf/src/content/parser.rs:168 β€” xberg_native_pdf::content::parser::parse_content_stream_paths_only has cognitive complexity 66 (threshold 15). Drivers by points: if/else 10 (27 pts), match/switch 7 (23 pts), loops 4 (9 pts), boolean chains 7 (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.
  • xberg_native_pdf::structure::parser::parse_k_children (cognitive 63) crates/xberg-native-pdf/src/structure/parser.rs:504 β€” xberg_native_pdf::structure::parser::parse_k_children has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (36 pts), match/switch 8 (24 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 43). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_horizontal_rules (cognitive 63) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:4163 β€” xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_horizontal_rules has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (46 pts), loops 6 (10 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::structure::spatial_table_detector::split_table_at_section_dividers (cognitive 62) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3682 β€” xberg_native_pdf::structure::spatial_table_detector::split_table_at_section_dividers has cognitive complexity 62 (threshold 15). Drivers by points: if/else 25 (45 pts), loops 8 (12 pts), boolean chains 5 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::structure::spatial_table_detector::detect_merged_cells (cognitive 57) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:4805 β€” xberg_native_pdf::structure::spatial_table_detector::detect_merged_cells has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (36 pts), loops 8 (20 pts), boolean chains 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.
  • xberg_native_pdf::structure::spatial_table_detector::group_lines_into_clusters (cognitive 56) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:1545 β€” xberg_native_pdf::structure::spatial_table_detector::group_lines_into_clusters has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 10 (19 pts), boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::structure::spatial_table_detector::detect_merged_cells_visually (cognitive 55) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:1956 β€” xberg_native_pdf::structure::spatial_table_detector::detect_merged_cells_visually has cognitive complexity 55 (threshold 15). Drivers by points: loops 10 (28 pts), if/else 9 (24 pts), boolean chains 3 (nesting depth added 33). 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.
  • xberg_native_pdf::structure::spatial_table_detector::build_cells_from_intersections (cognitive 53) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2432 β€” xberg_native_pdf::structure::spatial_table_detector::build_cells_from_intersections has cognitive complexity 53 (threshold 15). Drivers by points: if/else 7 (24 pts), boolean chains 18, loops 5 (11 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.
  • xberg_native_pdf::rendering::page_renderer::evaluate_type0_multi (cognitive 50) crates/xberg-native-pdf/src/rendering/page_renderer.rs:8094 β€” xberg_native_pdf::rendering::page_renderer::evaluate_type0_multi has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (37 pts), loops 7 (10 pts), boolean chains 2, match/switch 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.
  • xberg_native_pdf::xref::parse_xref_stream (cognitive 50) crates/xberg-native-pdf/src/xref.rs:709 β€” xberg_native_pdf::xref::parse_xref_stream has cognitive complexity 50 (threshold 15). Drivers by points: if/else 24 (35 pts), loops 5 (8 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::xref::parse_traditional_xref (cognitive 47) crates/xberg-native-pdf/src/xref.rs:522 β€” xberg_native_pdf::xref::parse_traditional_xref has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (30 pts), match/switch 3 (9 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::structure::spatial_table_detector::strip_form_numbering_artifacts (cognitive 46) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2977 β€” xberg_native_pdf::structure::spatial_table_detector::strip_form_numbering_artifacts has cognitive complexity 46 (threshold 15). Drivers by points: if/else 7 (24 pts), boolean chains 13, loops 5 (9 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_native_pdf::fonts::cmap::line_parsers::parse_bfchar_line (cognitive 43) crates/xberg-native-pdf/src/fonts/cmap/line_parsers.rs:63 β€” xberg_native_pdf::fonts::cmap::line_parsers::parse_bfchar_line has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • xberg_native_pdf::structure::parser::parse_struct_elem (cognitive 42) crates/xberg-native-pdf/src/structure/parser.rs:341 β€” xberg_native_pdf::structure::parser::parse_struct_elem has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (28 pts), match/switch 5 (10 pts), boolean chains 4 (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.
  • xberg_native_pdf::structure::table_extractor::extract_cell (cognitive 42) crates/xberg-native-pdf/src/structure/table_extractor.rs:619 β€” xberg_native_pdf::structure::table_extractor::extract_cell has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (36 pts), boolean chains 4, loops 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.
  • xberg_native_pdf::rendering::mesh_shading::decode_patches (cognitive 41) crates/xberg-native-pdf/src/rendering/mesh_shading.rs:409 β€” xberg_native_pdf::rendering::mesh_shading::decode_patches has cognitive complexity 41 (threshold 15). Drivers by points: match/switch 6 (16 pts), loops 5 (12 pts), if/else 7 (11 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 97 more in this group β€” see findings.md.
D15 Β· Churn × Complexity Hotspots Β· Repeated repair Β· Γ—120
  • Repeated repair: crates/xberg/src/core/config/ocr.rs crates/xberg/src/core/config/ocr.rs:1146 β€” crates/xberg/src/core/config/ocr.rs changed 47 times in last 90 days and 32 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 OcrConfig::validate at line 1146), 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(ocr): size the resample of an untagged image by its text”; β€œfix(ci): align feature-specific OCR gates”; β€œfix(ocr): preserve Arabic and Hebrew reading order”; β€œfix(ocr): accept legacy PaddleOCR camelCase keys”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/core/config/ocr.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/xberg/src/table_core.rs crates/xberg/src/table_core.rs:412 β€” crates/xberg/src/table_core.rs changed 35 times in last 90 days and 26 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 xberg::table_core::fold_right_aligned_tracks at line 412), 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(ocr): keep a repeated column edge from merging into the neighbouring cell”; β€œfix(pdf): preserve numeric separators within table cells”; β€œfix(ocr): preserve Arabic and Hebrew reading order”; β€œfix(ocr): preserve invoice table rows and quantities”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/table_core.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/xberg/src/pdf/render.rs crates/xberg/src/pdf/render.rs:357 β€” crates/xberg/src/pdf/render.rs changed 36 times in last 90 days and 25 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 xberg::pdf::render::render_page_capturing_glyph_drops at line 357), 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(build): gate config-dependent items for narrow feature legs”; β€œfix(ocr): isolate selected-page failures”; β€œfix(pdf): enforce the password the render path was handed”; β€œfix(pdf): report parallel render warnings in page order (#1852)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/render.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/xberg/src/paddle_ocr/backend.rs crates/xberg/src/paddle_ocr/backend.rs:1563 β€” crates/xberg/src/paddle_ocr/backend.rs changed 39 times in last 90 days and 24 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 PaddleOcrBackend::process_image at line 1563), 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(ort): share one ONNX Runtime environment across core, Paddle and GLiNER”; β€œfix(ocr): preserve lenient legacy Paddle config”; β€œfix(ocr): preserve PaddleOCR config compatibility”; β€œfix(ocr): type paddle_ocr_config as PaddleOcrConfig in every binding”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/paddle_ocr/backend.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/xberg/src/extractors/security.rs crates/xberg/src/extractors/security.rs:362 β€” crates/xberg/src/extractors/security.rs changed 31 times in last 90 days and 22 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 ZipBombValidator::validate at line 362), 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(redaction): preserve the findings safety ceiling”; β€œfix(redaction): reuse the iteration security limit”; β€œfix(excel): harden spreadsheet parsing (#2024)”; β€œfix(layout): charge each detection batch against the budget, not the whole document (#1730)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/security.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/xberg/src/ocr/processor/config.rs crates/xberg/src/ocr/processor/config.rs:42 β€” crates/xberg/src/ocr/processor/config.rs changed 27 times in last 90 days and 22 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 xberg::ocr::processor::config::hash_security_limits at line 42), 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(ocr): honor configured Tesseract engine modes”; β€œfix(ocr): keep embedded-image retry text beside a table that claimed no page text (#2009)”; β€œfix(ocr): return Tesseract line elements at the default element level (#1981)”; β€œfix(ocr): route the scan-detection signal into OCR preprocessing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/ocr/processor/config.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/xberg/src/extractors/pdf/layout_runner.rs crates/xberg/src/extractors/pdf/layout_runner.rs:392 β€” crates/xberg/src/extractors/pdf/layout_runner.rs changed 28 times in last 90 days and 20 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 xberg::extractors::pdf::layout_runner::render_layout_chunk at line 392), 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(pdf): five fixes to layout, formula and VLM region handling in native PDF extraction (#2232)”; β€œfix(ocr): isolate selected-page failures”; β€œfix(ocr): preserve page assembly in fallback”; β€œfix(pdf): delete the unreachable non-tokio layout runner branch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/pdf/layout_runner.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/xberg/src/ocr/tesseract_backend.rs crates/xberg/src/ocr/tesseract_backend.rs:759 β€” crates/xberg/src/ocr/tesseract_backend.rs changed 28 times in last 90 days and 18 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 xberg::ocr::tesseract_backend::normalize_vertical_cjk_result at line 759), 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(ocr): hand Tesseract display-rotated PDF pages upright”; β€œfix(ocr): route the scan-detection signal into OCR preprocessing”; β€œfix(ocr): probe tessdata for the configured languages, widen the memo key”; β€œfix(ocr): honour a configured tessdata_path in the language probe”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/ocr/tesseract_backend.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/xberg/src/extractors/pdf/ocr/rendering.rs crates/xberg/src/extractors/pdf/ocr/rendering.rs:415 β€” crates/xberg/src/extractors/pdf/ocr/rendering.rs changed 23 times in last 90 days and 15 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 xberg::extractors::pdf::ocr::rendering::account_xobject_structured_output at line 415), 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(ocr): preserve PDF layout segmentation for scans”; β€œfix(wasm): keep OCR block lookup feature-safe”; β€œfix(ocr): keep embedded-image retry text beside a table that claimed no page text (#2009)”; β€œfix(ocr): keep the scan segmentation mode on scans with unmapped text (#1947)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/pdf/ocr/rendering.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/xberg-native-pdf/src/decoders/jpx.rs crates/xberg-native-pdf/src/decoders/jpx.rs:374 β€” crates/xberg-native-pdf/src/decoders/jpx.rs changed 20 times in last 90 days and 15 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 xberg_native_pdf::decoders::jpx::decode_subsampled at line 374), 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: β€œchore: integrate fixes and dependency upgrades for 1.3.11”; β€œfix(pdf): bump hayro-jpeg2000 to 0.4.1 and drop its palette workaround (#2111)”; β€œfix(pdf): reject conflicting JPX palettes”; β€œfix(pdf): preserve JPEG 2000 opacity semantics”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/decoders/jpx.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/xberg/src/candle_ocr/glm_ocr_backend.rs crates/xberg/src/candle_ocr/glm_ocr_backend.rs:433 β€” crates/xberg/src/candle_ocr/glm_ocr_backend.rs changed 20 times in last 90 days and 13 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is GlmOcrBackend::parse_options at line 433), 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(ocr): validate backend options before any page runs”; β€œfix(ocr): resolve the layout model once per process, not once per page (#1720)”; β€œfix(ocr): drop implausible-script and bare-LaTeX lines from candle OCR”; β€œfix(candle-ocr): stop GLM-OCR penalising repeats per occurrence”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/candle_ocr/glm_ocr_backend.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/xberg/src/core/config_validation/sections.rs crates/xberg/src/core/config_validation/sections.rs:413 β€” crates/xberg/src/core/config_validation/sections.rs changed 18 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 5 (its worst body is xberg::core::config_validation::sections::validate_language_code at line 413), 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(ocr): send tesseract thresholding_method as an integer, not a bool”; β€œfix(ocr): accept every Tesseract language code in config validation”; β€œfix(ocr): reject tesseract psm 0, which recognises no text”; β€œfix(ocr): accept plugin-registered OCR backends during validation”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/core/config_validation/sections.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: tools/benchmark-harness/src/adapters/subprocess.rs tools/benchmark-harness/src/adapters/subprocess.rs:161 β€” tools/benchmark-harness/src/adapters/subprocess.rs changed 20 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is SubprocessAdapter::with_format_aware at line 161), 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(benchmarks): bind provenance to executable build”; β€œfix(bench): preserve native paths and report signals”; β€œfix(bench): use boolean assertions”; β€œfix(bench): preserve adaptive Tesseract fallback”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- tools/benchmark-harness/src/adapters/subprocess.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/xberg/src/ocr/types.rs crates/xberg/src/ocr/types.rs:297 β€” crates/xberg/src/ocr/types.rs changed 12 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is TesseractConfig::validate at line 297), 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(ocr): route the scan-detection signal into OCR preprocessing”; β€œfix(pdf): refuse a decompression limit of 0 instead of disabling the cap”; β€œfix(ocr): send tesseract thresholding_method as an integer, not a bool”; β€œfix(ocr): carry configured security_limits into the Tesseract decode”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/ocr/types.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/xberg/src/cache/version.rs crates/xberg/src/cache/version.rs:112 β€” crates/xberg/src/cache/version.rs changed 11 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is xberg::cache::version::cache_version_tag at line 112), 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(ocr): size the resample of an untagged image by its text”; β€œfix(pdf): keep bordered tables detected beside strict tables”; β€œfix(images): do not warn when an image has no EXIF block”; β€œfix: batch OCR, cache, and macOS release repairs (#2034)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/cache/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.
  • Repeated repair: crates/xberg/src/pdf/scan_detect.rs crates/xberg/src/pdf/scan_detect.rs:135 β€” crates/xberg/src/pdf/scan_detect.rs changed 19 times in last 90 days and 10 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 xberg::pdf::scan_detect::score_page at line 135), 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(ocr): keep the scan segmentation mode on scans with unmapped text (#1947)”; β€œfix(ocr): count mapped artifact glyphs in scan guard”; β€œfix(ocr): ignore fallback glyphs in scan detection”; β€œfix(pdf): gate the OCR scan-density policy by its consumers”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/scan_detect.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: tools/benchmark-harness/src/validate_artifacts.rs tools/benchmark-harness/src/validate_artifacts.rs:96 β€” tools/benchmark-harness/src/validate_artifacts.rs changed 14 times in last 90 days and 10 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 benchmark_harness::validate_artifacts::require_artifact_args at line 96), 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(benchmarks): separate cold and steady-state timing”; β€œfix(benchmarks): count zero-overlap samples as accountable failures”; β€œfix(bench): expect OCR used for the image cohort”; β€œfix(bench): publish failed cells, segment rankings, and fix quality scoring”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- tools/benchmark-harness/src/validate_artifacts.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/xberg/src/candle_ocr/deepseek_ocr_backend.rs crates/xberg/src/candle_ocr/deepseek_ocr_backend.rs:45 β€” crates/xberg/src/candle_ocr/deepseek_ocr_backend.rs changed 14 times in last 90 days and 10 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 xberg::candle_ocr::deepseek_ocr_backend::requested_dtype at line 45), 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(ocr): validate backend options before any page runs”; β€œfix(ocr): report when auto device selection falls back to the CPU (#1722)”; β€œfix(ocr): drop implausible-script and bare-LaTeX lines from candle OCR”; β€œfix(candle-ocr): pick the DeepSeek-OCR dtype from the device”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/candle_ocr/deepseek_ocr_backend.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: crates/xberg/src/extractors/doc.rs crates/xberg/src/extractors/doc.rs:70 β€” crates/xberg/src/extractors/doc.rs changed 13 times in last 90 days and 10 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 DocExtractor::extract_content at line 70), 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(doc): retain direct scripts and UTF-16 story boundaries”; β€œfix(doc): extract inline pictures for embedded OCR”; β€œfix(doc): enforce cell budgets before assembling tables”; β€œfix(doc): enforce ambiguous story filters”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/doc.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/xberg/src/extraction/image_decode.rs crates/xberg/src/extraction/image_decode.rs:467 β€” crates/xberg/src/extraction/image_decode.rs changed 11 times in last 90 days and 10 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 xberg::extraction::image_decode::standard_image_is_single_frame at line 467), 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(ocr): gate two image helpers on the pdf feature like their callers”; β€œfix(image): compare the decode budget against bytes only”; β€œfix(image): gate decode helpers on their callers' features”; β€œfix(image): gate conversion wrappers by consumers”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extraction/image_decode.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/xberg/src/plugins/registry/mod.rs crates/xberg/src/plugins/registry/mod.rs:47 β€” crates/xberg/src/plugins/registry/mod.rs changed 16 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 3 (its worst body is xberg::plugins::registry::validate_plugin_name at line 47), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot β€” the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: β€œfix(build): gate config-dependent items for narrow feature legs”; β€œfix(test): restore full-feature registry helpers”; β€œfix(ocr): gate automatic backend lookup by its consumers (#1831)”; β€œfix(plugins): retry registry clears held off by a live snapshot lease”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/plugins/registry/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: tools/benchmark-harness/src/runner.rs tools/benchmark-harness/src/runner.rs:41 β€” tools/benchmark-harness/src/runner.rs changed 16 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 4 (its worst body is BenchmarkRunner::select_frameworks at line 41), 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(bench): retain partial batch results”; β€œfix(benchmark-harness): validate fixture file_type against its document”; β€œchore: linting fixes”; β€œfix(bench): publish failed cells, segment rankings, and fix quality scoring”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- tools/benchmark-harness/src/runner.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/xberg/src/extraction/excel.rs crates/xberg/src/extraction/excel.rs:647 β€” crates/xberg/src/extraction/excel.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 11 (its worst body is xberg::extraction::excel::generate_markdown_and_cells at line 647), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot β€” the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: β€œfix(excel): remove binary noise from float cells”; β€œfix(excel): read date, time and duration cells as the sheet shows them”; β€œfix(xberg): clear the three -D warnings errors behind the svg type errors”; β€œfix(ooxml): validate the PPTX and XLSX containers, not just entry count”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extraction/excel.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/xberg/src/types/internal_builder.rs crates/xberg/src/types/internal_builder.rs:192 β€” crates/xberg/src/types/internal_builder.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 8 (its worst body is InternalDocumentBuilder::push_table_from_cells_with_styles at line 192), 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(rendering): keep every footnote definition on the footnote layer”; β€œfix(ocr): preserve image list source numbers (#1984)”; β€œfix(pdf): report measured font size in page hierarchy blocks”; β€œfix: complete v1.1.0 release repairs”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/types/internal_builder.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/xberg/src/types/formats.rs crates/xberg/src/types/formats.rs:13 β€” crates/xberg/src/types/formats.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 4 (its worst body is xberg::types::formats::deserialize_languages at line 13), 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(schema): omit null for optional OCR and keyword refs (#2042)”; β€œfix(ocr): report a shaded-row normalization that cannot act”; β€œfix(ocr): send tesseract thresholding_method as an integer, not a bool”; β€œfix(ocr): reject tesseract psm 0, which recognises no text”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/types/formats.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.
  • + 95 more in this group β€” see findings.md.
D3 Β· God Classes Β· FileTooLong Β· Γ—119
  • FileTooLong: rendering/page_renderer.rs crates/xberg-native-pdf/src/rendering/page_renderer.rs β€” FileTooLong β€” 5145 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 78% of them inside a single declaration: PageRenderer (2 blocks, 207-7465), declaring 44 free functions. The bar is 500 significant lines; this is 4645 over it, 10.29× 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: bindings/dynamic_bindings.rs crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs β€” FileTooLong β€” 4553 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 99% of them inside a single declaration: DynamicPdfiumBindings (4 blocks, 35-6018). The bar is 500 significant lines; this is 4053 over it, 9.11× 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: structure/pipeline.rs crates/xberg/src/pdf/structure/pipeline.rs β€” FileTooLong β€” 4009 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 164 free functions. The bar is 500 significant lines; this is 3509 over it, 8.02× 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: ocr/pipeline.rs crates/xberg/src/extractors/pdf/ocr/pipeline.rs β€” FileTooLong β€” 3680 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 60 free functions. The bar is 500 significant lines; this is 3180 over it, 7.36× 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: bindings/static_bindings.rs crates/xberg-pdfium-render/src/bindings/static_bindings.rs β€” FileTooLong β€” 2846 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 99% of them inside a single declaration: StaticPdfiumBindings (4 blocks, 34-3832). The bar is 500 significant lines; this is 2346 over it, 5.69× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body β€” the parts that share the same inputs and are named together β€” into its own unit in a sibling file, and have the original call them.
  • FileTooLong: extractors/image.rs crates/xberg/src/extractors/image.rs β€” FileTooLong β€” 2835 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 104 free functions. The bar is 500 significant lines; this is 2335 over it, 5.67× 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: structure/spatial_table_detector.rs crates/xberg-native-pdf/src/structure/spatial_table_detector.rs β€” FileTooLong β€” 2757 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 67 free functions. The bar is 500 significant lines; this is 2257 over it, 5.51× 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: fonts/font_dict.rs crates/xberg-native-pdf/src/fonts/font_dict.rs β€” FileTooLong β€” 2704 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 82% of them inside a single declaration: FontInfo (3 blocks, 47-5278). The bar is 500 significant lines; this is 2204 over it, 5.41× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body β€” the parts that share the same inputs and are named together β€” into its own unit in a sibling file, and have the original call them.
  • FileTooLong: content/parser.rs crates/xberg-native-pdf/src/content/parser.rs β€” FileTooLong β€” 2538 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 96 free functions. The bar is 500 significant lines; this is 2038 over it, 5.08× 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: docx/parser.rs crates/xberg/src/extraction/docx/parser.rs β€” FileTooLong β€” 2259 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 35 free functions. The bar is 500 significant lines; this is 1759 over it, 4.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: pdf/mod.rs crates/xberg/src/extractors/pdf/mod.rs β€” FileTooLong β€” 2213 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 57 free functions. The bar is 500 significant lines; this is 1713 over it, 4.43× 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: extractors/images.rs crates/xberg-native-pdf/src/extractors/images.rs β€” FileTooLong β€” 2129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 67 free functions. The bar is 500 significant lines; this is 1629 over it, 4.26× 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/bindings.rs crates/xberg-pdfium-render/src/bindings.rs β€” FileTooLong β€” 2091 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 98% of them inside a single declaration: PdfiumLibraryBindings (98-8061). The bar is 500 significant lines; this is 1591 over it, 4.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body β€” the parts that share the same inputs and are named together β€” into its own unit in a sibling file, and have the original call them.
  • FileTooLong: rendering/separation_renderer.rs crates/xberg-native-pdf/src/rendering/separation_renderer.rs β€” FileTooLong β€” 1960 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 50 free functions. The bar is 500 significant lines; this is 1460 over it, 3.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: processor/execution.rs crates/xberg/src/ocr/processor/execution.rs β€” FileTooLong β€” 1716 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 48 free functions. The bar is 500 significant lines; this is 1216 over it, 3.43× 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: pdf/table_reconstruct.rs crates/xberg/src/pdf/table_reconstruct.rs β€” FileTooLong β€” 1704 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 73 free functions. The bar is 500 significant lines; this is 1204 over it, 3.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: native/table.rs crates/xberg/src/pdf/native/table.rs β€” FileTooLong β€” 1506 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 86 free functions. The bar is 500 significant lines; this is 1006 over it, 3.01× 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: ocr/document.rs crates/xberg/src/extractors/pdf/ocr/document.rs β€” FileTooLong β€” 1498 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 62 free functions. The bar is 500 significant lines; this is 998 over it, 3.00× 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: native/text.rs crates/xberg/src/pdf/native/text.rs β€” FileTooLong β€” 1487 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 79 free functions. The bar is 500 significant lines; this is 987 over it, 2.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: document/columns.rs crates/xberg-native-pdf/src/document/columns.rs β€” FileTooLong β€” 1444 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 100% of them inside a single declaration: PdfDocument (14-2709). The bar is 500 significant lines; this is 944 over it, 2.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/model_download.rs crates/xberg/src/model_download.rs β€” FileTooLong β€” 1401 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 901 over it, 2.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: structure/classify.rs crates/xberg/src/pdf/structure/classify.rs β€” FileTooLong β€” 1268 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 55 free functions. The bar is 500 significant lines; this is 768 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: regions/table_recognition.rs crates/xberg/src/pdf/structure/regions/table_recognition.rs β€” FileTooLong β€” 1230 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 730 over it, 2.46× 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: engine/extract_impl.rs crates/xberg/src/engine/extract_impl.rs β€” FileTooLong β€” 1224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), declaring 70 free functions. The bar is 500 significant lines; this is 724 over it, 2.45× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: extractors/rst.rs crates/xberg/src/extractors/rst.rs β€” FileTooLong β€” 1223 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), about 90% of them inside a single declaration: RstExtractor (4 blocks, 203-1843). The bar is 500 significant lines; this is 723 over it, 2.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.
  • + 94 more in this group β€” see findings.md.
D1 Β· Cyclomatic Complexity Β· xberg Β· Γ—97
  • xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page (cyclomatic 140) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310 β€” xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page has cyclomatic complexity 140 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::jats::elements::extract_jats_all_in_one (cyclomatic 111) crates/xberg/src/extractors/jats/elements.rs:15 β€” xberg::extractors::jats::elements::extract_jats_all_in_one has cyclomatic complexity 111 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::pdf::table_reconstruct::post_process_table_inner (cyclomatic 110) crates/xberg/src/pdf/table_reconstruct.rs:494 β€” xberg::pdf::table_reconstruct::post_process_table_inner has cyclomatic complexity 110 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs (cyclomatic 90) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:611 β€” xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::rendering::comrak_bridge::build_comrak_ast (cyclomatic 89) crates/xberg/src/rendering/comrak_bridge.rs:883 β€” xberg::rendering::comrak_bridge::build_comrak_ast has cyclomatic complexity 89 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::jats::build_jats_internal_document (cyclomatic 86) crates/xberg/src/extractors/jats/mod.rs:231 β€” xberg::extractors::jats::build_jats_internal_document has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::docbook::parse_docbook_single_pass (cyclomatic 81) crates/xberg/src/extractors/docbook.rs:530 β€” xberg::extractors::docbook::parse_docbook_single_pass has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::docx::build_internal_document (cyclomatic 80) crates/xberg/src/extractors/docx.rs:88 β€” xberg::extractors::docx::build_internal_document has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::ocr::processor::execution::perform_ocr (cyclomatic 67) crates/xberg/src/ocr/processor/execution.rs:1799 β€” xberg::ocr::processor::execution::perform_ocr has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::docbook::build_docbook_internal_document (cyclomatic 66) crates/xberg/src/extractors/docbook.rs:253 β€” xberg::extractors::docbook::build_docbook_internal_document has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::pdf::structure::classify::classify_paragraphs (cyclomatic 64) crates/xberg/src/pdf/structure/classify.rs:91 β€” xberg::pdf::structure::classify::classify_paragraphs has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::rendering::djot::render_djot (cyclomatic 64) crates/xberg/src/rendering/djot.rs:16 β€” xberg::rendering::djot::render_djot has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::jats::parser::extract_citation_text (cyclomatic 60) crates/xberg/src/extractors/jats/parser.rs:108 β€” xberg::extractors::jats::parser::extract_citation_text has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::latex::commands::process_command (cyclomatic 59) crates/xberg/src/extractors/latex/commands.rs:47 β€” xberg::extractors::latex::commands::process_command has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::pdf::structure::pipeline::build_document_structure (cyclomatic 58) crates/xberg/src/pdf/structure/pipeline.rs:3354 β€” xberg::pdf::structure::pipeline::build_document_structure has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::docbook::extract_para_with_annotations (cyclomatic 52) crates/xberg/src/extractors/docbook.rs:1121 β€” xberg::extractors::docbook::extract_para_with_annotations has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::odt::build_internal_elements (cyclomatic 47) crates/xberg/src/extractors/odt.rs:754 β€” xberg::extractors::odt::build_internal_elements has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::ocr::hocr_parser::parse_paragraph (cyclomatic 46) crates/xberg/src/ocr/hocr_parser.rs:675 β€” xberg::ocr::hocr_parser::parse_paragraph has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extractors::docbook::extract_element_text_with_inline (cyclomatic 43) crates/xberg/src/extractors/docbook.rs:865 β€” xberg::extractors::docbook::extract_element_text_with_inline has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::extraction::ppt::extract_texts_from_records (cyclomatic 42) crates/xberg/src/extraction/ppt/mod.rs:659 β€” xberg::extraction::ppt::extract_texts_from_records has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::core::pipeline::features::execute_chunking (cyclomatic 41) crates/xberg/src/core/pipeline/features.rs:410 β€” xberg::core::pipeline::features::execute_chunking has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg::pdf::table_reconstruct::is_well_formed_table_core (cyclomatic 38) crates/xberg/src/pdf/table_reconstruct.rs:2119 β€” xberg::pdf::table_reconstruct::is_well_formed_table_core 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.
  • xberg::extractors::jats::extract_para_with_annotations_jats (cyclomatic 36) crates/xberg/src/extractors/jats/mod.rs:55 β€” xberg::extractors::jats::extract_para_with_annotations_jats 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.
  • xberg::extractors::pdf::extraction::extract_all_from_native_document (cyclomatic 36) crates/xberg/src/extractors/pdf/extraction.rs:482 β€” xberg::extractors::pdf::extraction::extract_all_from_native_document 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.
  • xberg::pdf::structure::layout_classify::apply_hint_to_paragraph (cyclomatic 36) crates/xberg/src/pdf/structure/layout_classify.rs:396 β€” xberg::pdf::structure::layout_classify::apply_hint_to_paragraph has cyclomatic complexity 36 (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.
  • + 72 more in this group β€” see findings.md.
D15 Β· Churn × Complexity Hotspots Β· Hotspot Β· Γ—97
  • Hotspot: crates/xberg/src/extractors/pdf/mod.rs crates/xberg/src/extractors/pdf/mod.rs:2250 β€” crates/xberg/src/extractors/pdf/mod.rs changed 96 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in PdfExtractor::extract_core_native at line 2250. 64 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/pdf/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/xberg/src/extractors/pdf/ocr/pipeline.rs crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs changed 66 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 140 in xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page at line 2310. 55 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/pdf/ocr/pipeline.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/xberg/src/extraction/docx/parser.rs crates/xberg/src/extraction/docx/parser.rs:2647 β€” crates/xberg/src/extraction/docx/parser.rs changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 184 in DocxParser::parse_body_elements at line 2647. 33 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extraction/docx/parser.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/xberg/src/ocr/processor/execution.rs crates/xberg/src/ocr/processor/execution.rs:1799 β€” crates/xberg/src/ocr/processor/execution.rs changed 75 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in xberg::ocr::processor::execution::perform_ocr at line 1799. 60 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/ocr/processor/execution.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/xberg/src/pdf/table_reconstruct.rs crates/xberg/src/pdf/table_reconstruct.rs:494 β€” crates/xberg/src/pdf/table_reconstruct.rs changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 110 in xberg::pdf::table_reconstruct::post_process_table_inner at line 494. 35 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/table_reconstruct.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/xberg/src/extractors/markdown.rs crates/xberg/src/extractors/markdown.rs:127 β€” crates/xberg/src/extractors/markdown.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 254 in MarkdownExtractor::build_internal_document_with_jsx at line 127. 13 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/markdown.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/xberg/src/pdf/structure/pipeline.rs crates/xberg/src/pdf/structure/pipeline.rs:3354 β€” crates/xberg/src/pdf/structure/pipeline.rs changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in xberg::pdf::structure::pipeline::build_document_structure at line 3354. 56 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/structure/pipeline.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/xberg-native-pdf/src/rendering/page_renderer.rs crates/xberg-native-pdf/src/rendering/page_renderer.rs:966 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 167 in PageRenderer::execute_operators at line 966. 14 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/rendering/page_renderer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/xberg/src/extractors/docx.rs crates/xberg/src/extractors/docx.rs:88 β€” crates/xberg/src/extractors/docx.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in xberg::extractors::docx::build_internal_document at line 88. 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-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/docx.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/xberg/src/extractors/rst.rs crates/xberg/src/extractors/rst.rs:986 β€” crates/xberg/src/extractors/rst.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 182 in RstExtractor::build_internal_document_within at line 986. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one β€” a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/rst.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/xberg/src/extractors/djot_format/extractor.rs crates/xberg/src/extractors/djot_format/extractor.rs:37 β€” crates/xberg/src/extractors/djot_format/extractor.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 172 in DjotExtractor::build_internal_document at line 37. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/djot_format/extractor.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/xberg-native-pdf/src/fonts/font_dict.rs crates/xberg-native-pdf/src/fonts/font_dict.rs:4319 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in FontInfo::char_to_unicode_uncached at line 4319. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/fonts/font_dict.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/xberg/src/rendering/comrak_bridge.rs crates/xberg/src/rendering/comrak_bridge.rs:883 β€” crates/xberg/src/rendering/comrak_bridge.rs changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in xberg::rendering::comrak_bridge::build_comrak_ast at line 883. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/rendering/comrak_bridge.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/xberg/src/extractors/orgmode.rs crates/xberg/src/extractors/orgmode.rs:340 β€” crates/xberg/src/extractors/orgmode.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in OrgModeExtractor::build_internal_document at line 340. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/orgmode.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/xberg/src/extractors/image.rs crates/xberg/src/extractors/image.rs:2846 β€” crates/xberg/src/extractors/image.rs changed 78 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ImageExtractor::extract_with_ocr at line 2846. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/image.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/xberg/src/extractors/pdf/extraction.rs crates/xberg/src/extractors/pdf/extraction.rs:482 β€” crates/xberg/src/extractors/pdf/extraction.rs changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in xberg::extractors::pdf::extraction::extract_all_from_native_document at line 482. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/pdf/extraction.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/xberg-native-pdf/src/rendering/separation_renderer.rs crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1489 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in xberg_native_pdf::rendering::separation_renderer::execute_separation_operators at line 1489. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/rendering/separation_renderer.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/xberg/src/extractors/typst.rs crates/xberg/src/extractors/typst.rs:87 β€” crates/xberg/src/extractors/typst.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 85 in TypstExtractor::build_internal_document at line 87. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/typst.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/xberg-native-pdf/src/extractors/images.rs crates/xberg-native-pdf/src/extractors/images.rs:1385 β€” crates/xberg-native-pdf/src/extractors/images.rs changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in xberg_native_pdf::extractors::images::extract_image_from_xobject at line 1385. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/extractors/images.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/xberg/src/core/pipeline/mod.rs crates/xberg/src/core/pipeline/mod.rs:449 β€” crates/xberg/src/core/pipeline/mod.rs changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in xberg::core::pipeline::run_pipeline_impl at line 449. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/core/pipeline/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each β€” a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: crates/xberg/src/pdf/structure/classify.rs crates/xberg/src/pdf/structure/classify.rs:91 β€” crates/xberg/src/pdf/structure/classify.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in xberg::pdf::structure::classify::classify_paragraphs at line 91. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/structure/classify.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/xberg-native-pdf/src/structure/spatial_table_detector.rs crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3682 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in xberg_native_pdf::structure::spatial_table_detector::split_table_at_section_dividers at line 3682. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg-native-pdf/src/structure/spatial_table_detector.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/xberg/src/core/config/extraction/core.rs crates/xberg/src/core/config/extraction/core.rs:738 β€” crates/xberg/src/core/config/extraction/core.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in ExtractionConfig::with_file_overrides at line 738. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/core/config/extraction/core.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/xberg/src/pdf/structure/adapters.rs crates/xberg/src/pdf/structure/adapters.rs:1466 β€” crates/xberg/src/pdf/structure/adapters.rs changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in xberg::pdf::structure::adapters::reattach_ocr_layout_list_markers at line 1466. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/pdf/structure/adapters.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/xberg/src/extractors/docbook.rs crates/xberg/src/extractors/docbook.rs:530 β€” crates/xberg/src/extractors/docbook.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in xberg::extractors::docbook::parse_docbook_single_pass at line 530. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 07:03:26 +02:00' --until='2026-10-27 07:03:26 +02:00' --full-history --no-merges -- crates/xberg/src/extractors/docbook.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.
  • + 72 more in this group β€” see findings.md.
D2 Β· Cognitive Complexity Β· PdfDocument Β· Γ—76
  • PdfDocument::assemble_text_from_spans (cognitive 313) crates/xberg-native-pdf/src/document/text_assembly.rs:313 β€” PdfDocument::assemble_text_from_spans has cognitive complexity 313 (threshold 15). Drivers by points: if/else 73 (208 pts), loops 21 (80 pts), boolean chains 22, match/switch 1 (3 pts) (nesting depth added 196). Of this number, 284 points are the body's own statements and 29 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PdfDocument::extract_widget_spans (cognitive 119) crates/xberg-native-pdf/src/document/annotations.rs:33 β€” PdfDocument::extract_widget_spans has cognitive complexity 119 (threshold 15). Drivers by points: if/else 23 (59 pts), match/switch 21 (48 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::extract_embedded_fonts_with_unicode_maps_and_widths (cognitive 114) crates/xberg-native-pdf/src/document/fonts.rs:1060 β€” PdfDocument::extract_embedded_fonts_with_unicode_maps_and_widths has cognitive complexity 114 (threshold 15). Drivers by points: if/else 23 (68 pts), loops 9 (32 pts), match/switch 4 (13 pts), boolean chains 1 (nesting depth added 77). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::load_fonts (cognitive 113) crates/xberg-native-pdf/src/document/fonts.rs:485 β€” PdfDocument::load_fonts has cognitive complexity 113 (threshold 15). Drivers by points: if/else 22 (68 pts), loops 6 (26 pts), match/switch 4 (16 pts), boolean chains 3 (nesting depth added 78). 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.
  • PdfDocument::extract_page_tables (cognitive 84) crates/xberg-native-pdf/src/document/tables.rs:579 β€” PdfDocument::extract_page_tables has cognitive complexity 84 (threshold 15). Drivers by points: if/else 25 (57 pts), boolean chains 11, loops 2 (10 pts), match/switch 3 (6 pts) (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PdfDocument::extract_text_structure_order_cached_with_spans (cognitive 77) crates/xberg-native-pdf/src/document/reading_order.rs:832 β€” PdfDocument::extract_text_structure_order_cached_with_spans has cognitive complexity 77 (threshold 15). Drivers by points: if/else 24 (58 pts), loops 7 (13 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PdfDocument::topological_block_order (cognitive 76) crates/xberg-native-pdf/src/document/columns.rs:1889 β€” PdfDocument::topological_block_order has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (44 pts), loops 14 (19 pts), boolean chains 13 (nesting depth added 24). Of this number, 75 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.
  • PdfDocument::process_form_xobject_paths (cognitive 68) crates/xberg-native-pdf/src/document/paths.rs:391 β€” PdfDocument::process_form_xobject_paths has cognitive complexity 68 (threshold 15). Drivers by points: if/else 28 (48 pts), match/switch 9 (15 pts), loops 2 (5 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.
  • PdfDocument::merge_sub_superscript_spans (cognitive 68) crates/xberg-native-pdf/src/document/spans_text.rs:928 β€” PdfDocument::merge_sub_superscript_spans has cognitive complexity 68 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 13, loops 4 (8 pts), match/switch 1 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::append_non_widget_annotation_text (cognitive 67) crates/xberg-native-pdf/src/document/annotations.rs:591 β€” PdfDocument::append_non_widget_annotation_text has cognitive complexity 67 (threshold 15). Drivers by points: if/else 15 (45 pts), match/switch 9 (16 pts), boolean chains 5, loops 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::extract_words_inner (cognitive 66) crates/xberg-native-pdf/src/document/extract_api.rs:1293 β€” PdfDocument::extract_words_inner has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 6 (11 pts), boolean chains 10, match/switch 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::extract_text_lines_inner (cognitive 59) crates/xberg-native-pdf/src/document/extract_api.rs:1650 β€” PdfDocument::extract_text_lines_inner has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (34 pts), loops 9 (16 pts), match/switch 3 (5 pts), boolean chains 4 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::reorder_rowspan_labels (cognitive 56) crates/xberg-native-pdf/src/document/tables.rs:158 β€” PdfDocument::reorder_rowspan_labels has cognitive complexity 56 (threshold 15). Drivers by points: if/else 25 (35 pts), loops 8 (14 pts), boolean chains 7 (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.
  • PdfDocument::annotation_content_spans (cognitive 53) crates/xberg-native-pdf/src/document/annotations.rs:341 β€” PdfDocument::annotation_content_spans has cognitive complexity 53 (threshold 15). Drivers by points: match/switch 13 (28 pts), if/else 10 (19 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 26). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own 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.
  • PdfDocument::extract_images_from_form_xobject (cognitive 52) crates/xberg-native-pdf/src/document/images.rs:972 β€” PdfDocument::extract_images_from_form_xobject has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (45 pts), match/switch 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::reverse_rtl_visual_order_runs (cognitive 52) crates/xberg-native-pdf/src/document/spans_text.rs:35 β€” PdfDocument::reverse_rtl_visual_order_runs has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 9 (15 pts), boolean chains 8 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::collect_image_handles_from_form_xobject (cognitive 49) crates/xberg-native-pdf/src/document/images.rs:546 β€” PdfDocument::collect_image_handles_from_form_xobject has cognitive complexity 49 (threshold 15). Drivers by points: if/else 22 (41 pts), match/switch 4 (6 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::get_page_by_scanning (cognitive 49) crates/xberg-native-pdf/src/document/pages.rs:680 β€” PdfDocument::get_page_by_scanning has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (36 pts), boolean chains 8, loops 4 (5 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PdfDocument::has_persistent_gutter_corridor (cognitive 47) crates/xberg-native-pdf/src/document/columns.rs:1474 β€” PdfDocument::has_persistent_gutter_corridor has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (27 pts), loops 8 (11 pts), boolean chains 9 (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.
  • PdfDocument::load_uncompressed_object_impl (cognitive 47) crates/xberg-native-pdf/src/document/objects.rs:892 β€” PdfDocument::load_uncompressed_object_impl has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 12, match/switch 4 (7 pts), loops 3 (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.
  • PdfDocument::sidebar_body_reading_order (cognitive 45) crates/xberg-native-pdf/src/document/columns.rs:1646 β€” PdfDocument::sidebar_body_reading_order has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 8 (11 pts), boolean chains 9, 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.
  • PdfDocument::actualtext_actions_for_page (cognitive 44) crates/xberg-native-pdf/src/document/reading_order.rs:684 β€” PdfDocument::actualtext_actions_for_page has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 6 (13 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PdfDocument::page_image_handles (cognitive 41) crates/xberg-native-pdf/src/document/images.rs:320 β€” PdfDocument::page_image_handles has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (36 pts), match/switch 3 (4 pts), loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (PdfDocument::extract_images_filtered) 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.
  • PdfDocument::extract_images_filtered (cognitive 41) crates/xberg-native-pdf/src/document/images.rs:719 β€” PdfDocument::extract_images_filtered has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (36 pts), match/switch 3 (4 pts), loops 1 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (PdfDocument::page_image_handles) 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.
  • PdfDocument::extract_images_from_xobject_do (cognitive 38) crates/xberg-native-pdf/src/document/images.rs:841 β€” PdfDocument::extract_images_from_xobject_do has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 4 (7 pts), boolean chains 5 (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.
  • + 51 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 2) Β· Γ—74
  • Duplicated block (7 lines × 2) crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:180 β€” crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:180-186 | crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:264-270 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/content/parser.rs:742 β€” crates/xberg-native-pdf/src/content/parser.rs:742-748 | crates/xberg-native-pdf/src/content/parser.rs:978-984 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/lexer.rs:175 β€” crates/xberg-native-pdf/src/lexer.rs:175-181 | crates/xberg-native-pdf/src/lexer.rs:184-190 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/parser.rs:298 β€” crates/xberg-native-pdf/src/parser.rs:298-307 | crates/xberg-native-pdf/src/parser.rs:312-318 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:961 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:961-967 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1441-1447 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2583 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2583-2589 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2060-2066 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2617 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2617-2623 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2083-2089 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3269 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:3269-3282 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3387-3393 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6157 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:6157-6163 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6224-6230 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7045 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7045-7051 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:7059-7065 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7660 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7660-7666 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:7670-7676 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2745 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2745-2751 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:3278-3284 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/sidecar.rs:288 β€” crates/xberg-native-pdf/src/rendering/sidecar.rs:288-294 | crates/xberg-native-pdf/src/rendering/sidecar.rs:303-309 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1378 β€” crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1378-1384 | crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1440-1447 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:516 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:516-522 | crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:556-562 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-native-pdf/src/text/word_boundary.rs:163 β€” crates/xberg-native-pdf/src/text/word_boundary.rs:163-169 | crates/xberg-native-pdf/src/text/word_boundary.rs:182-188 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:360 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:360-366 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:422-428 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg-tesseract/src/page_iterator.rs:231 β€” crates/xberg-tesseract/src/page_iterator.rs:231-237 | crates/xberg-tesseract/src/page_iterator.rs:280-286 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg/src/api/handlers.rs:1177 β€” crates/xberg/src/api/handlers.rs:1177-1183 | crates/xberg/src/mcp/server.rs:636-642 β€” 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/xberg/src/api/openweb.rs:89 β€” crates/xberg/src/api/openweb.rs:89-95 | crates/xberg/src/api/openweb.rs:148-154 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg/src/candle_ocr/paddleocr_vl_backend.rs:78 β€” crates/xberg/src/candle_ocr/paddleocr_vl_backend.rs:78-84 | crates/xberg/src/candle_ocr/trocr_backend.rs:116-122 β€” 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/xberg/src/core/config/extraction/core.rs:819 β€” crates/xberg/src/core/config/extraction/core.rs:819-825 | crates/xberg/src/core/config/extraction/core.rs:870-876 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg/src/extraction/archive/tar.rs:232 β€” crates/xberg/src/extraction/archive/tar.rs:232-238 | crates/xberg/src/extraction/archive/zip.rs:229-235 β€” before extracting anything, compare `crates/xberg/src/extraction/archive/tar.rs` and `crates/xberg/src/extraction/archive/zip.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (7 lines × 2) crates/xberg/src/extraction/derive/mod.rs:246 β€” crates/xberg/src/extraction/derive/mod.rs:246-252 | crates/xberg/src/extraction/derive/mod.rs:275-281 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) crates/xberg/src/extraction/docx/parser.rs:2542 β€” crates/xberg/src/extraction/docx/parser.rs:2542-2548 | crates/xberg/src/extraction/docx/parser.rs:3636-3642 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • + 49 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (5 lines × 2) Β· Γ—69
  • Duplicated block (5 lines × 2) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:735 β€” crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:735-739 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:801-805 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:1349 β€” crates/xberg-native-pdf/src/document/extract_api.rs:1349-1353 | crates/xberg-native-pdf/src/document/extract_api.rs:1703-1707 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/document/mod.rs:1129 β€” crates/xberg-native-pdf/src/document/mod.rs:1129-1133 | crates/xberg-native-pdf/src/rendering/sidecar.rs:1587-1591 β€” 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/xberg-native-pdf/src/extractors/images.rs:375 β€” crates/xberg-native-pdf/src/extractors/images.rs:375-379 | crates/xberg-native-pdf/src/extractors/images.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.
  • Duplicated block (5 lines × 2) crates/xberg-native-pdf/src/extractors/images.rs:2611 β€” crates/xberg-native-pdf/src/extractors/images.rs:2611-2615 | crates/xberg-native-pdf/src/extractors/images.rs:2731-2735 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/object.rs:365 β€” crates/xberg-native-pdf/src/object.rs:365-370 | crates/xberg-native-pdf/src/xref.rs:968-972 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/xberg-native-pdf/src/redaction/serialize.rs:314 β€” crates/xberg-native-pdf/src/redaction/serialize.rs:314-318 | crates/xberg-native-pdf/src/redaction/serialize.rs:400-404 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:2633 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2633-2637 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2046-2050 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (5 lines × 2) crates/xberg-native-pdf/src/rendering/sidecar.rs:1157 β€” crates/xberg-native-pdf/src/rendering/sidecar.rs:1157-1161 | crates/xberg-native-pdf/src/rendering/sidecar.rs:1252-1256 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/xref_reconstruction.rs:460 β€” crates/xberg-native-pdf/src/xref_reconstruction.rs:460-464 | crates/xberg-native-pdf/src/xref_reconstruction.rs:646-650 β€” both copies are in the same file, so extract the 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/xberg-tesseract/src/api.rs:1644 β€” crates/xberg-tesseract/src/api.rs:1644-1648 | crates/xberg-tesseract/src/api.rs:1730-1734 β€” both copies are in the same file, so extract the 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/xberg-tesseract/src/result_iterator.rs:297 β€” crates/xberg-tesseract/src/result_iterator.rs:297-301 | crates/xberg-tesseract/src/result_iterator.rs:319-323 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/xberg/src/engine/extract_impl.rs:111 β€” crates/xberg/src/engine/extract_impl.rs:111-115 | crates/xberg/src/engine/extract_impl.rs:270-274 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/excel/open.rs:464 β€” crates/xberg/src/extraction/excel/open.rs:464-468 | crates/xberg/src/extraction/excel/open.rs:474-478 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/pptx/parser.rs:229 β€” crates/xberg/src/extraction/pptx/parser.rs:229-233 | crates/xberg/src/extraction/pptx/parser.rs:461-465 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/docx.rs:714 β€” crates/xberg/src/extractors/docx.rs:714-718 | crates/xberg/src/extractors/wordperfect.rs:658-662 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/xberg/src/extractors/fictionbook.rs:143 β€” crates/xberg/src/extractors/fictionbook.rs:143-148 | crates/xberg/src/extractors/jats/parser.rs:115-119 β€” before extracting anything, compare `crates/xberg/src/extractors/fictionbook.rs` and `crates/xberg/src/extractors/jats/parser.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 × 2) crates/xberg/src/extractors/iwork/keynote.rs:130 β€” crates/xberg/src/extractors/iwork/keynote.rs:130-134 | crates/xberg/src/extractors/iwork/pages.rs:85-89 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 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 (5 lines × 2) crates/xberg/src/extractors/iwork/numbers.rs:302 β€” crates/xberg/src/extractors/iwork/numbers.rs:302-306 | crates/xberg/src/extractors/iwork/numbers.rs:362-366 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/odp.rs:433 β€” crates/xberg/src/extractors/odp.rs:433-437 | crates/xberg/src/extractors/odt.rs:1642-1646 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 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 (5 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1092 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1092-1100 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1225-1229 β€” both copies are in the same file, so extract the 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/xberg/src/layout/models/slanet.rs:220 β€” crates/xberg/src/layout/models/slanet.rs:220-224 | crates/xberg/src/layout/models/tatr.rs:221-225 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) crates/xberg/src/mcp/server.rs:194 β€” crates/xberg/src/mcp/server.rs:194-198 | crates/xberg/src/mcp/server.rs:228-233 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/xberg/src/mcp/server.rs:718 β€” crates/xberg/src/mcp/server.rs:718-722 | crates/xberg/src/mcp/server.rs:731-735 β€” both copies are in the same file, so extract the 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/xberg/src/ocr/hocr_parser.rs:1015 β€” crates/xberg/src/ocr/hocr_parser.rs:1015-1019 | crates/xberg/src/ocr/hocr_parser.rs:1047-1051 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • + 44 more in this group β€” see findings.md.
D3 Β· God Classes Β· MethodTooLong Β· Γ—65
  • MethodTooLong: PageRenderer.execute_operators crates/xberg-native-pdf/src/rendering/page_renderer.rs:966 β€” MethodTooLong β€” execute_operators runs 1173 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 1073 over it, 11.73× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfExtractor.extract_core_native crates/xberg/src/extractors/pdf/mod.rs:2250 β€” MethodTooLong β€” extract_core_native runs 928 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 828 over it, 9.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: MarkdownExtractor.build_internal_document_with_jsx crates/xberg/src/extractors/markdown.rs:127 β€” MethodTooLong β€” build_internal_document_with_jsx runs 624 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 524 over it, 6.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: DocxParser.parse_body_elements crates/xberg/src/extraction/docx/parser.rs:2647 β€” MethodTooLong β€” parse_body_elements runs 559 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 459 over it, 5.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: DynamicPdfiumBindings.new crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:1262 β€” MethodTooLong β€” new runs 520 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 420 over it, 5.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: DjotExtractor.build_internal_document crates/xberg/src/extractors/djot_format/extractor.rs:37 β€” MethodTooLong β€” build_internal_document runs 487 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 387 over it, 4.87× 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: TextExtractor.execute_operator crates/xberg-native-pdf/src/extractors/text/operators.rs:14 β€” MethodTooLong β€” execute_operator runs 446 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 346 over it, 4.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: RstExtractor.build_internal_document_within crates/xberg/src/extractors/rst.rs:986 β€” MethodTooLong β€” build_internal_document_within runs 436 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 336 over it, 4.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: DocxExtractor.extract_content crates/xberg/src/extractors/docx.rs:914 β€” MethodTooLong β€” extract_content runs 362 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 262 over it, 3.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfDocument.assemble_text_from_spans crates/xberg-native-pdf/src/document/text_assembly.rs:313 β€” MethodTooLong β€” assemble_text_from_spans runs 351 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 251 over it, 3.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: FontInfo.from_dict crates/xberg-native-pdf/src/fonts/font_dict.rs:737 β€” MethodTooLong β€” from_dict runs 339 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 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: OrgModeExtractor.build_internal_document crates/xberg/src/extractors/orgmode.rs:340 β€” MethodTooLong β€” build_internal_document runs 328 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 228 over it, 3.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: FontInfo.char_to_unicode_uncached crates/xberg-native-pdf/src/fonts/font_dict.rs:4319 β€” MethodTooLong β€” char_to_unicode_uncached runs 326 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 226 over it, 3.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.
  • MethodTooLong: TextExtractor.merge_adjacent_spans crates/xberg-native-pdf/src/extractors/text/span_merging.rs:12 β€” MethodTooLong β€” merge_adjacent_spans runs 281 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 181 over it, 2.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: EpubExtractor.build_internal_document crates/xberg/src/extractors/epub/mod.rs:221 β€” MethodTooLong β€” build_internal_document runs 268 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 168 over it, 2.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.
  • MethodTooLong: TypstExtractor.build_internal_document crates/xberg/src/extractors/typst.rs:87 β€” MethodTooLong β€” build_internal_document runs 262 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 162 over it, 2.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: TextRasterizer.render_unicode_text crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1075 β€” MethodTooLong β€” render_unicode_text runs 247 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 147 over it, 2.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: PageRenderer.render_image crates/xberg-native-pdf/src/rendering/page_renderer.rs:3629 β€” MethodTooLong β€” render_image runs 215 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 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: TextExtractor.process_xobject crates/xberg-native-pdf/src/extractors/text/xobjects.rs:140 β€” MethodTooLong β€” process_xobject runs 211 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 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfDocument.process_form_xobject_paths crates/xberg-native-pdf/src/document/paths.rs:391 β€” MethodTooLong β€” process_form_xobject_paths runs 207 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 107 over it, 2.07× 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: ImageExtractor.extract_with_ocr crates/xberg/src/extractors/image.rs:2846 β€” MethodTooLong β€” extract_with_ocr 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.
  • MethodTooLong: PdfDocument.load_uncompressed_object_impl crates/xberg-native-pdf/src/document/objects.rs:892 β€” MethodTooLong β€” load_uncompressed_object_impl runs 200 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 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfDocument.extract_page_tables crates/xberg-native-pdf/src/document/tables.rs:579 β€” MethodTooLong β€” extract_page_tables runs 198 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfDocument.extract_widget_spans crates/xberg-native-pdf/src/document/annotations.rs:33 β€” MethodTooLong β€” extract_widget_spans runs 195 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 95 over it, 1.95× 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: PageRenderer.fill_with_tiling_pattern crates/xberg-native-pdf/src/rendering/page_renderer.rs:4505 β€” MethodTooLong β€” fill_with_tiling_pattern runs 192 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 92 over it, 1.92× 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.
  • + 40 more in this group β€” see findings.md.
D1 Β· Cyclomatic Complexity Β· xberg_native_pdf Β· Γ—62
  • xberg_native_pdf::fonts::font_dict::standard_encoding_lookup (cyclomatic 221) crates/xberg-native-pdf/src/fonts/font_dict.rs:6046 β€” xberg_native_pdf::fonts::font_dict::standard_encoding_lookup has cyclomatic complexity 221 (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.
  • xberg_native_pdf::rendering::separation_renderer::execute_separation_operators (cyclomatic 101) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1489 β€” xberg_native_pdf::rendering::separation_renderer::execute_separation_operators has cyclomatic complexity 101 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::functions::execute (cyclomatic 83) crates/xberg-native-pdf/src/functions/mod.rs:546 β€” xberg_native_pdf::functions::execute has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::content::parser::parse_content_stream_paths_only (cyclomatic 64) crates/xberg-native-pdf/src/content/parser.rs:168 β€” xberg_native_pdf::content::parser::parse_content_stream_paths_only has cyclomatic complexity 64 (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.
  • xberg_native_pdf::content::parser::forward_scan_ctm (cyclomatic 58) crates/xberg-native-pdf/src/content/parser.rs:691 β€” xberg_native_pdf::content::parser::forward_scan_ctm has cyclomatic complexity 58 (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.
  • xberg_native_pdf::extractors::text::should_insert_space (cyclomatic 53) crates/xberg-native-pdf/src/extractors/text/mod.rs:1170 β€” xberg_native_pdf::extractors::text::should_insert_space 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.
  • xberg_native_pdf::content::parser::parse_text_operator_fast (cyclomatic 46) crates/xberg-native-pdf/src/content/parser.rs:4064 β€” xberg_native_pdf::content::parser::parse_text_operator_fast has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::content::parser::scan_graphics_region (cyclomatic 41) crates/xberg-native-pdf/src/content/parser.rs:4256 β€” xberg_native_pdf::content::parser::scan_graphics_region has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::extractors::images::extract_image_from_xobject (cyclomatic 39) crates/xberg-native-pdf/src/extractors/images.rs:1385 β€” xberg_native_pdf::extractors::images::extract_image_from_xobject has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::structure::spatial_table_detector::split_table_at_section_dividers (cyclomatic 37) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3682 β€” xberg_native_pdf::structure::spatial_table_detector::split_table_at_section_dividers 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.
  • xberg_native_pdf::structure::spatial_table_detector::detect_tables_in_cluster (cyclomatic 34) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:1781 β€” xberg_native_pdf::structure::spatial_table_detector::detect_tables_in_cluster has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::structure::spatial_table_detector::build_cells_from_intersections (cyclomatic 31) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2432 β€” xberg_native_pdf::structure::spatial_table_detector::build_cells_from_intersections has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • xberg_native_pdf::xref::parse_xref_stream (cyclomatic 30) crates/xberg-native-pdf/src/xref.rs:709 β€” xberg_native_pdf::xref::parse_xref_stream 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.
  • xberg_native_pdf::rendering::resolution::color::evaluate_type0_sampled (cyclomatic 28) crates/xberg-native-pdf/src/rendering/resolution/color.rs:820 β€” xberg_native_pdf::rendering::resolution::color::evaluate_type0_sampled has cyclomatic complexity 28 (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.
  • xberg_native_pdf::rendering::separation_renderer::tint_for_ink (cyclomatic 27) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1073 β€” xberg_native_pdf::rendering::separation_renderer::tint_for_ink 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.
  • xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_horizontal_rules (cyclomatic 27) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:4163 β€” xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_horizontal_rules 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.
  • xberg_native_pdf::structure::parser::parse_k_children (cyclomatic 26) crates/xberg-native-pdf/src/structure/parser.rs:504 β€” xberg_native_pdf::structure::parser::parse_k_children 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.
  • xberg_native_pdf::structure::spatial_table_detector::detect_page_columns (cyclomatic 26) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:491 β€” xberg_native_pdf::structure::spatial_table_detector::detect_page_columns 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.
  • xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_spans (cyclomatic 26) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:705 β€” xberg_native_pdf::structure::spatial_table_detector::detect_tables_from_spans 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.
  • xberg_native_pdf::structure::spatial_table_detector::split_rows_by_text_positions (cyclomatic 26) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2764 β€” xberg_native_pdf::structure::spatial_table_detector::split_rows_by_text_positions 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.
  • xberg_native_pdf::structure::spatial_table_detector::strip_form_numbering_artifacts (cyclomatic 26) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2977 β€” xberg_native_pdf::structure::spatial_table_detector::strip_form_numbering_artifacts 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.
  • xberg_native_pdf::xref::parse_traditional_xref (cyclomatic 26) crates/xberg-native-pdf/src/xref.rs:522 β€” xberg_native_pdf::xref::parse_traditional_xref 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.
  • xberg_native_pdf::rendering::page_renderer::evaluate_type0_multi (cyclomatic 25) crates/xberg-native-pdf/src/rendering/page_renderer.rs:8094 β€” xberg_native_pdf::rendering::page_renderer::evaluate_type0_multi 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.
  • xberg_native_pdf::content::parser::skip_array_raw (cyclomatic 24) crates/xberg-native-pdf/src/content/parser.rs:3290 β€” xberg_native_pdf::content::parser::skip_array_raw has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • xberg_native_pdf::structure::parser::parse_struct_elem (cyclomatic 24) crates/xberg-native-pdf/src/structure/parser.rs:341 β€” xberg_native_pdf::structure::parser::parse_struct_elem 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.
  • + 37 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (9 lines × 2) Β· Γ—57
  • Duplicated block (9 lines × 2) crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:687 β€” crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:687-695 | crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:704-712 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/content/parser.rs:262 β€” crates/xberg-native-pdf/src/content/parser.rs:262-270 | crates/xberg-native-pdf/src/content/parser.rs:4318-4326 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/document/mod.rs:1119 β€” crates/xberg-native-pdf/src/document/mod.rs:1119-1127 | crates/xberg-native-pdf/src/rendering/sidecar.rs:1577-1585 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/xberg-native-pdf/src/encryption/algorithms.rs:572 β€” crates/xberg-native-pdf/src/encryption/algorithms.rs:572-580 | crates/xberg-native-pdf/src/encryption/algorithms.rs:586-594 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/extractors/images.rs:1932 β€” crates/xberg-native-pdf/src/extractors/images.rs:1932-1940 | crates/xberg-native-pdf/src/extractors/images.rs:1958-1966 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/fonts/font_dict.rs:5778 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:5778-5787 | crates/xberg-native-pdf/src/fonts/font_dict.rs:5967-5975 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/lib.rs:282 β€” crates/xberg-native-pdf/src/lib.rs:282-290 | crates/xberg-native-pdf/src/lib.rs:345-353 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/xberg-native-pdf/src/redaction/classify.rs:23 β€” crates/xberg-native-pdf/src/redaction/classify.rs:23-31 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1087-1095 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3639 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3639-3647 | crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3851-3859 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/xref.rs:628 β€” crates/xberg-native-pdf/src/xref.rs:628-636 | crates/xberg-native-pdf/src/xref.rs:639-647 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/action.rs:88 β€” crates/xberg-pdfium-render/src/pdf/action.rs:88-96 | crates/xberg-pdfium-render/src/pdf/action.rs:101-109 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/document/page/object.rs:144 β€” crates/xberg-pdfium-render/src/pdf/document/page/object.rs:144-152 | crates/xberg-pdfium-render/src/pdf/document/page/object.rs:156-164 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/document/page/size.rs:233 β€” crates/xberg-pdfium-render/src/pdf/document/page/size.rs:233-241 | crates/xberg-pdfium-render/src/pdf/document/page/size.rs:291-299 β€” both copies are in the same file, so extract the 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/xberg-tesseract/build_support/source_cache.rs:380 β€” crates/xberg-tesseract/build_support/source_cache.rs:380-388 | crates/xberg-tesseract/build_support/source_cache.rs:393-401 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/xberg-tesseract/src/api.rs:276 β€” crates/xberg-tesseract/src/api.rs:276-284 | crates/xberg-tesseract/src/api.rs:714-722 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/xberg/src/chunking/text_splitter/splitter.rs:71 β€” crates/xberg/src/chunking/text_splitter/splitter.rs:71-79 | crates/xberg/src/chunking/text_splitter/splitter/markdown.rs:210-218 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/xberg/src/embeddings/engine.rs:68 β€” crates/xberg/src/embeddings/engine.rs:68-76 | crates/xberg/src/reranking/engine.rs:139-147 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/xberg/src/engine/extract_impl.rs:142 β€” crates/xberg/src/engine/extract_impl.rs:142-150 | crates/xberg/src/engine/extract_impl.rs:283-291 β€” both copies are in the same file, so extract the 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/xberg/src/engine/extract_impl.rs:893 β€” crates/xberg/src/engine/extract_impl.rs:893-901 | crates/xberg/src/engine/extract_impl.rs:918-926 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/archive/sevenz.rs:144 β€” crates/xberg/src/extraction/archive/sevenz.rs:144-152 | crates/xberg/src/extraction/archive/sevenz.rs:219-227 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/doc/metadata.rs:112 β€” crates/xberg/src/extraction/doc/metadata.rs:112-120 | crates/xberg/src/extraction/ppt/mod.rs:1509-1517 β€” before extracting anything, compare `crates/xberg/src/extraction/doc/metadata.rs` and `crates/xberg/src/extraction/ppt/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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/xberg/src/extraction/docx/drawing.rs:519 β€” crates/xberg/src/extraction/docx/drawing.rs:519-527 | crates/xberg/src/extraction/docx/drawing.rs:574-582 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) crates/xberg/src/extraction/docx/math/collect.rs:10 β€” crates/xberg/src/extraction/docx/math/collect.rs:10-18 | crates/xberg/src/extraction/docx/math/elements.rs:843-851 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) crates/xberg/src/extraction/docx/math/render.rs:265 β€” crates/xberg/src/extraction/docx/math/render.rs:265-273 | crates/xberg/src/extraction/mathml/render.rs:262-270 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) crates/xberg/src/extraction/docx/parser.rs:628 β€” crates/xberg/src/extraction/docx/parser.rs:628-636 | crates/xberg/src/extraction/docx/parser.rs:725-733 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • + 32 more in this group β€” see findings.md.
D3 Β· God Classes Β· FunctionTooLong Β· Γ—56
  • FunctionTooLong: xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2310 β€” FunctionTooLong β€” xberg::extractors::pdf::ocr::pipeline::extract_with_ocr_for_page runs 1169 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 1069 over it, 11.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs crates/xberg/src/extractors/pdf/ocr/pipeline.rs:611 β€” FunctionTooLong β€” xberg::extractors::pdf::ocr::pipeline::extract_mixed_ocr_native_with_layout_inputs runs 963 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 863 over it, 9.63× 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: xberg_native_pdf::rendering::separation_renderer::execute_separation_operators crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1489 β€” FunctionTooLong β€” xberg_native_pdf::rendering::separation_renderer::execute_separation_operators runs 612 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 512 over it, 6.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::ocr::processor::execution::perform_ocr crates/xberg/src/ocr/processor/execution.rs:1799 β€” FunctionTooLong β€” xberg::ocr::processor::execution::perform_ocr runs 497 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 397 over it, 4.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::pdf::structure::pipeline::build_document_structure crates/xberg/src/pdf/structure/pipeline.rs:3354 β€” FunctionTooLong β€” xberg::pdf::structure::pipeline::build_document_structure runs 491 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 391 over it, 4.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.
  • FunctionTooLong: xberg::rendering::comrak_bridge::build_comrak_ast crates/xberg/src/rendering/comrak_bridge.rs:883 β€” FunctionTooLong β€” xberg::rendering::comrak_bridge::build_comrak_ast runs 409 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 309 over it, 4.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::pdf::extraction::extract_all_from_native_document crates/xberg/src/extractors/pdf/extraction.rs:482 β€” FunctionTooLong β€” xberg::extractors::pdf::extraction::extract_all_from_native_document runs 327 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 227 over it, 3.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::jats::elements::extract_jats_all_in_one crates/xberg/src/extractors/jats/elements.rs:15 β€” FunctionTooLong β€” xberg::extractors::jats::elements::extract_jats_all_in_one runs 307 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 207 over it, 3.07× 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: xberg_cli::main crates/xberg-cli/src/main.rs:836 β€” FunctionTooLong β€” xberg_cli::main runs 294 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 194 over it, 2.94× 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: xberg::extractors::docx::build_internal_document crates/xberg/src/extractors/docx.rs:88 β€” FunctionTooLong β€” xberg::extractors::docx::build_internal_document runs 260 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 160 over it, 2.60× 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: xberg::extractors::pdf::ocr::pipeline::run_ocr_pipeline_stages crates/xberg/src/extractors/pdf/ocr/pipeline.rs:4914 β€” FunctionTooLong β€” xberg::extractors::pdf::ocr::pipeline::run_ocr_pipeline_stages runs 259 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::pdf::run_ocr_with_layout crates/xberg/src/extractors/pdf/mod.rs:1111 β€” FunctionTooLong β€” xberg::extractors::pdf::run_ocr_with_layout runs 245 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::ocr::hocr_parser::parse_paragraph crates/xberg/src/ocr/hocr_parser.rs:675 β€” FunctionTooLong β€” xberg::ocr::hocr_parser::parse_paragraph runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::docbook::parse_docbook_single_pass crates/xberg/src/extractors/docbook.rs:530 β€” FunctionTooLong β€” xberg::extractors::docbook::parse_docbook_single_pass runs 236 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 136 over it, 2.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extraction::ppt::extract_texts_from_records crates/xberg/src/extraction/ppt/mod.rs:659 β€” FunctionTooLong β€” xberg::extraction::ppt::extract_texts_from_records runs 231 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 131 over it, 2.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::rendering::djot::render_djot crates/xberg/src/rendering/djot.rs:16 β€” FunctionTooLong β€” xberg::rendering::djot::render_djot runs 231 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 131 over it, 2.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::jats::build_jats_internal_document crates/xberg/src/extractors/jats/mod.rs:231 β€” FunctionTooLong β€” xberg::extractors::jats::build_jats_internal_document runs 208 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 108 over it, 2.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::core::pipeline::features::execute_chunking crates/xberg/src/core/pipeline/features.rs:410 β€” FunctionTooLong β€” xberg::core::pipeline::features::execute_chunking runs 201 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 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::odt::build_internal_elements crates/xberg/src/extractors/odt.rs:754 β€” FunctionTooLong β€” xberg::extractors::odt::build_internal_elements runs 201 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 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg::extractors::docbook::build_docbook_internal_document crates/xberg/src/extractors/docbook.rs:253 β€” FunctionTooLong β€” xberg::extractors::docbook::build_docbook_internal_document runs 195 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 95 over it, 1.95× 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: xberg_native_pdf::content::parser::forward_scan_ctm crates/xberg-native-pdf/src/content/parser.rs:691 β€” FunctionTooLong β€” xberg_native_pdf::content::parser::forward_scan_ctm runs 194 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 94 over it, 1.94× 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: xberg::pdf::structure::regions::tables::extract_tables_from_layout_hints crates/xberg/src/pdf/structure/regions/tables.rs:26 β€” FunctionTooLong β€” xberg::pdf::structure::regions::tables::extract_tables_from_layout_hints runs 193 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • FunctionTooLong: xberg_native_pdf::extractors::images::extract_image_from_xobject crates/xberg-native-pdf/src/extractors/images.rs:1385 β€” FunctionTooLong β€” xberg_native_pdf::extractors::images::extract_image_from_xobject runs 192 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 92 over it, 1.92× 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: xberg_native_pdf::extractors::text::should_insert_space crates/xberg-native-pdf/src/extractors/text/mod.rs:1170 β€” FunctionTooLong β€” xberg_native_pdf::extractors::text::should_insert_space runs 192 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 92 over it, 1.92× 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: xberg_native_pdf::functions::execute crates/xberg-native-pdf/src/functions/mod.rs:546 β€” FunctionTooLong β€” xberg_native_pdf::functions::execute runs 190 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 90 over it, 1.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body β€” the runs of statements that work on the same values and would earn the same name β€” into its own named unit, and have this one call them in order.
  • + 31 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (10 lines × 2) Β· Γ—56
  • Duplicated block (10 lines × 2) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:721 β€” crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:721-730 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:786-795 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/xberg-native-pdf/src/annotations.rs:297 β€” crates/xberg-native-pdf/src/annotations.rs:297-306 | crates/xberg-native-pdf/src/annotations.rs:328-337 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/xberg-native-pdf/src/content/parser.rs:1167 β€” crates/xberg-native-pdf/src/content/parser.rs:1167-1176 | crates/xberg-native-pdf/src/content/parser.rs:3325-3334 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/extractors/images.rs:4372 β€” crates/xberg-native-pdf/src/extractors/images.rs:4372-4381 | crates/xberg-native-pdf/src/extractors/images.rs:4465-4474 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1895 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1895-1904 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:2183-2193 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:1337 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1337-1346 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1447-1456 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/resolution/color.rs:300 β€” crates/xberg-native-pdf/src/rendering/resolution/color.rs:300-309 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:347-356 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:23 β€” crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:23-32 | crates/xberg-pdfium-render/src/bindings/static_bindings.rs:21-30 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/annotation/objects.rs:82 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/objects.rs:82-91 | crates/xberg-pdfium-render/src/pdf/document/page/objects.rs:150-159 β€” 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 (10 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/object/private.rs:222 β€” crates/xberg-pdfium-render/src/pdf/document/page/object/private.rs:222-231 | crates/xberg-pdfium-render/src/pdf/document/page/object/private.rs:267-276 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/xberg-pdfium-render/src/pdf/font.rs:282 β€” crates/xberg-pdfium-render/src/pdf/font.rs:282-291 | crates/xberg-pdfium-render/src/pdf/font.rs:458-467 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/utils.rs:35 β€” crates/xberg-pdfium-render/src/utils.rs:35-44 | crates/xberg-pdfium-render/src/utils.rs:74-83 β€” both copies are in the same file, so extract the 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/xberg-tesseract/src/leptonica.rs:249 β€” crates/xberg-tesseract/src/leptonica.rs:249-258 | crates/xberg-tesseract/src/leptonica.rs:304-313 β€” both copies are in the same file, so extract the 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/xberg/src/core/config/extraction/core.rs:794 β€” crates/xberg/src/core/config/extraction/core.rs:794-803 | crates/xberg/src/core/config/extraction/core.rs:843-852 β€” both copies are in the same file, so extract the 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/xberg/src/core/image_encode.rs:290 β€” crates/xberg/src/core/image_encode.rs:290-299 | crates/xberg/src/core/image_encode.rs:330-339 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/xberg/src/core/split.rs:167 β€” crates/xberg/src/core/split.rs:167-176 | tools/benchmark-harness/src/split_benchmark.rs:162-171 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) crates/xberg/src/extraction/doc/mod.rs:976 β€” crates/xberg/src/extraction/doc/mod.rs:976-985 | crates/xberg/src/extraction/ppt/mod.rs:1428-1437 β€” `crates/xberg/src/extraction/doc/mod.rs` and `crates/xberg/src/extraction/ppt/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other β€” this scan matched 3 separate duplicated blocks between them, totalling at least 41 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) crates/xberg/src/extraction/image.rs:150 β€” crates/xberg/src/extraction/image.rs:150-159 | crates/xberg/src/extraction/image.rs:247-256 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/pptx/elements.rs:397 β€” crates/xberg/src/extraction/pptx/elements.rs:397-406 | crates/xberg/src/extraction/pptx/elements.rs:465-474 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/csv.rs:521 β€” crates/xberg/src/extractors/csv.rs:521-530 | crates/xberg/src/pdf/structure/regions/table_recognition.rs:1080-1089 β€” 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 (10 lines × 2) crates/xberg/src/extractors/djot_format/extractor.rs:43 β€” crates/xberg/src/extractors/djot_format/extractor.rs:43-52 | crates/xberg/src/extractors/markdown.rs:159-168 β€” before extracting anything, compare `crates/xberg/src/extractors/djot_format/extractor.rs` and `crates/xberg/src/extractors/markdown.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/xberg/src/extractors/docbook.rs:283 β€” crates/xberg/src/extractors/docbook.rs:283-292 | crates/xberg/src/extractors/docbook.rs:564-573 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/docbook.rs:1335 β€” crates/xberg/src/extractors/docbook.rs:1335-1344 | crates/xberg/src/extractors/jats/mod.rs:199-208 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) crates/xberg/src/extractors/epub/mod.rs:474 β€” crates/xberg/src/extractors/epub/mod.rs:474-483 | crates/xberg/src/extractors/odt.rs:539-548 β€” 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 (10 lines × 2) crates/xberg/src/extractors/fictionbook.rs:990 β€” crates/xberg/src/extractors/fictionbook.rs:990-999 | crates/xberg/src/extractors/jats/elements.rs:245-254 β€” 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.
  • + 31 more in this group β€” see findings.md.
D1 Β· Cyclomatic Complexity Β· PdfDocument Β· Γ—48
  • PdfDocument::assemble_text_from_spans (cyclomatic 108) crates/xberg-native-pdf/src/document/text_assembly.rs:313 β€” PdfDocument::assemble_text_from_spans has cyclomatic complexity 108 (threshold 15). Of this number, 98 points are the body's own statements and 10 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.
  • PdfDocument::process_form_xobject_paths (cyclomatic 65) crates/xberg-native-pdf/src/document/paths.rs:391 β€” PdfDocument::process_form_xobject_paths has cyclomatic complexity 65 (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.
  • PdfDocument::extract_widget_spans (cyclomatic 51) crates/xberg-native-pdf/src/document/annotations.rs:33 β€” PdfDocument::extract_widget_spans has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PdfDocument::topological_block_order (cyclomatic 51) crates/xberg-native-pdf/src/document/columns.rs:1889 β€” PdfDocument::topological_block_order has cyclomatic complexity 51 (threshold 15). Of this number, 50 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.
  • PdfDocument::extract_paths (cyclomatic 46) crates/xberg-native-pdf/src/document/paths.rs:46 β€” PdfDocument::extract_paths has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PdfDocument::extract_page_tables (cyclomatic 39) crates/xberg-native-pdf/src/document/tables.rs:579 β€” PdfDocument::extract_page_tables has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PdfDocument::append_non_widget_annotation_text (cyclomatic 38) crates/xberg-native-pdf/src/document/annotations.rs:591 β€” PdfDocument::append_non_widget_annotation_text 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.
  • PdfDocument::merge_sub_superscript_spans (cyclomatic 38) crates/xberg-native-pdf/src/document/spans_text.rs:928 β€” PdfDocument::merge_sub_superscript_spans 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 is NOT this file's highest cyclomatic complexity: PdfDocument::normalize_arabic_presentation_forms (cyclomatic 57) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • PdfDocument::load_uncompressed_object_impl (cyclomatic 36) crates/xberg-native-pdf/src/document/objects.rs:892 β€” PdfDocument::load_uncompressed_object_impl 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.
  • PdfDocument::extract_text_structure_order_cached_with_spans (cyclomatic 36) crates/xberg-native-pdf/src/document/reading_order.rs:832 β€” PdfDocument::extract_text_structure_order_cached_with_spans 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.
  • PdfDocument::reorder_rowspan_labels (cyclomatic 36) crates/xberg-native-pdf/src/document/tables.rs:158 β€” PdfDocument::reorder_rowspan_labels 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.
  • PdfDocument::extract_words_inner (cyclomatic 35) crates/xberg-native-pdf/src/document/extract_api.rs:1293 β€” PdfDocument::extract_words_inner 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.
  • PdfDocument::has_persistent_gutter_corridor (cyclomatic 34) crates/xberg-native-pdf/src/document/columns.rs:1474 β€” PdfDocument::has_persistent_gutter_corridor has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PdfDocument::sidebar_body_reading_order (cyclomatic 34) crates/xberg-native-pdf/src/document/columns.rs:1646 β€” PdfDocument::sidebar_body_reading_order has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PdfDocument::extract_text_lines_inner (cyclomatic 33) crates/xberg-native-pdf/src/document/extract_api.rs:1650 β€” PdfDocument::extract_text_lines_inner 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.
  • PdfDocument::load_fonts (cyclomatic 33) crates/xberg-native-pdf/src/document/fonts.rs:485 β€” PdfDocument::load_fonts 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.
  • PdfDocument::extract_embedded_fonts_with_unicode_maps_and_widths (cyclomatic 33) crates/xberg-native-pdf/src/document/fonts.rs:1060 β€” PdfDocument::extract_embedded_fonts_with_unicode_maps_and_widths 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.
  • PdfDocument::reverse_rtl_visual_order_runs (cyclomatic 30) crates/xberg-native-pdf/src/document/spans_text.rs:35 β€” PdfDocument::reverse_rtl_visual_order_runs 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. This is NOT this file's highest cyclomatic complexity: PdfDocument::normalize_arabic_presentation_forms (cyclomatic 57) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • PdfDocument::annotation_content_spans (cyclomatic 28) crates/xberg-native-pdf/src/document/annotations.rs:341 β€” PdfDocument::annotation_content_spans 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.
  • PdfDocument::classifier_column_gutter (cyclomatic 28) crates/xberg-native-pdf/src/document/columns.rs:710 β€” PdfDocument::classifier_column_gutter 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.
  • PdfDocument::extract_images_from_form_xobject (cyclomatic 28) crates/xberg-native-pdf/src/document/images.rs:972 β€” PdfDocument::extract_images_from_form_xobject 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.
  • PdfDocument::is_multi_column_page (cyclomatic 27) crates/xberg-native-pdf/src/document/columns.rs:1264 β€” PdfDocument::is_multi_column_page 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.
  • PdfDocument::collect_image_handles_from_form_xobject (cyclomatic 26) crates/xberg-native-pdf/src/document/images.rs:546 β€” PdfDocument::collect_image_handles_from_form_xobject 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.
  • PdfDocument::postprocess_spans (cyclomatic 25) crates/xberg-native-pdf/src/document/span_postprocess.rs:304 β€” PdfDocument::postprocess_spans 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.
  • PdfDocument::has_bimodal_line_starts (cyclomatic 24) crates/xberg-native-pdf/src/document/columns.rs:2236 β€” PdfDocument::has_bimodal_line_starts 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.
  • + 23 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (6 lines × 2) Β· Γ—48
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:888 β€” crates/xberg-native-pdf/src/document/extract_api.rs:888-894 | crates/xberg-native-pdf/src/document/extract_api.rs:989-994 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/extractors/text/mod.rs:1060 β€” crates/xberg-native-pdf/src/extractors/text/mod.rs:1060-1065 | crates/xberg-native-pdf/src/extractors/text/mod.rs:1100-1105 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/redaction/serialize.rs:250 β€” crates/xberg-native-pdf/src/redaction/serialize.rs:250-255 | crates/xberg-native-pdf/src/redaction/serialize.rs:259-264 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1249 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1249-1262 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1355-1360 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1505 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1505-1510 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1736-1741 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4592 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4592-4597 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:4703-4708 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5873 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5873-5878 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6470-6475 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2925 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:2925-2931 | crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3373-3378 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-native-pdf/src/structure/traversal.rs:290 β€” crates/xberg-native-pdf/src/structure/traversal.rs:290-295 | crates/xberg-native-pdf/src/structure/traversal.rs:405-410 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg-pdfium-render/src/pdf/font.rs:543 β€” crates/xberg-pdfium-render/src/pdf/font.rs:543-548 | crates/xberg-pdfium-render/src/pdf/font.rs:566-571 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/api/handlers.rs:297 β€” crates/xberg/src/api/handlers.rs:297-302 | crates/xberg/src/api/openweb.rs:199-204 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/xberg/src/extraction/doc/metadata.rs:126 β€” crates/xberg/src/extraction/doc/metadata.rs:126-131 | crates/xberg/src/extraction/ppt/mod.rs:1523-1528 β€” before extracting anything, compare `crates/xberg/src/extraction/doc/metadata.rs` and `crates/xberg/src/extraction/ppt/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 × 2) crates/xberg/src/extraction/docx/math/elements.rs:195 β€” crates/xberg/src/extraction/docx/math/elements.rs:195-200 | crates/xberg/src/extraction/docx/math/elements.rs:283-288 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/extraction/ooxml_embedded/mod.rs:318 β€” crates/xberg/src/extraction/ooxml_embedded/mod.rs:318-323 | crates/xberg/src/pdf/embedded_files.rs:183-188 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/xberg/src/extraction/pptx/mod.rs:165 β€” crates/xberg/src/extraction/pptx/mod.rs:165-170 | crates/xberg/src/extraction/pptx/mod.rs:587-592 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/extraction/pst/mod.rs:615 β€” crates/xberg/src/extraction/pst/mod.rs:615-620 | crates/xberg/src/extraction/pst/mod.rs:687-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.
  • Duplicated block (6 lines × 2) crates/xberg/src/extraction/transform/elements.rs:148 β€” crates/xberg/src/extraction/transform/elements.rs:148-153 | crates/xberg/src/types/document_structure.rs:57-62 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/doc.rs:81 β€” crates/xberg/src/extractors/doc.rs:81-86 | crates/xberg/src/extractors/ppt.rs:80-85 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/docbook.rs:905 β€” crates/xberg/src/extractors/docbook.rs:905-910 | crates/xberg/src/extractors/docbook.rs:913-918 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/excel.rs:324 β€” crates/xberg/src/extractors/excel.rs:324-329 | crates/xberg/src/extractors/pptx.rs:392-397 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/fictionbook.rs:592 β€” crates/xberg/src/extractors/fictionbook.rs:592-597 | crates/xberg/src/extractors/fictionbook.rs:887-892 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/jats/elements.rs:102 β€” crates/xberg/src/extractors/jats/elements.rs:102-107 | crates/xberg/src/extractors/jats/parser.rs:165-170 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/odp.rs:554 β€” crates/xberg/src/extractors/odp.rs:554-559 | crates/xberg/src/extractors/odt.rs:1763-1768 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1329 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1329-1334 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1347-1352 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/xberg/src/layout/models/pp_doclayout_v3.rs:258 β€” crates/xberg/src/layout/models/pp_doclayout_v3.rs:258-263 | crates/xberg/src/layout/models/pp_doclayout_v3.rs:456-461 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • + 23 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 2) Β· Γ—43
  • Duplicated block (8 lines × 2) crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:165 β€” crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:165-172 | crates/xberg-candle-ocr/src/models/glm_ocr/decoder.rs:187-194 β€” both copies are in the same file, so extract the 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/xberg-libheif/src/image.rs:149 β€” crates/xberg-libheif/src/image.rs:149-156 | crates/xberg-libheif/src/image.rs:189-196 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/annotations.rs:545 β€” crates/xberg-native-pdf/src/annotations.rs:545-552 | crates/xberg-native-pdf/src/annotations.rs:565-572 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/document/extract_api.rs:633 β€” crates/xberg-native-pdf/src/document/extract_api.rs:633-645 | crates/xberg-native-pdf/src/document/extract_api.rs:671-678 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/encryption/algorithms.rs:523 β€” crates/xberg-native-pdf/src/encryption/algorithms.rs:523-530 | crates/xberg-native-pdf/src/encryption/algorithms.rs:536-543 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/encryption/write_handler.rs:200 β€” crates/xberg-native-pdf/src/encryption/write_handler.rs:200-207 | crates/xberg-native-pdf/src/encryption/write_handler.rs:214-221 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/extractors/images.rs:4328 β€” crates/xberg-native-pdf/src/extractors/images.rs:4328-4335 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3705-3715 β€” 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/xberg-native-pdf/src/extractors/text/span_ordering.rs:244 β€” crates/xberg-native-pdf/src/extractors/text/span_ordering.rs:244-251 | crates/xberg-native-pdf/src/extractors/text/span_ordering.rs:347-354 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/fonts/font_dict.rs:2568 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:2568-2575 | crates/xberg-native-pdf/src/fonts/font_dict.rs:2674-2681 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:851 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:851-858 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:879-886 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:1264 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1264-1271 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1370-1377 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:9026 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:9026-9033 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:9081-9088 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/text_rasterizer.rs:1293 β€” crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1293-1300 | crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1333-1340 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/structure/types.rs:359 β€” crates/xberg-native-pdf/src/structure/types.rs:359-366 | crates/xberg-pdfium-render/src/pdf/document/page/struct_element.rs:117-125 β€” 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/xberg/src/core/extractor/bytes.rs:84 β€” crates/xberg/src/core/extractor/bytes.rs:84-91 | crates/xberg/src/core/extractor/file.rs:194-201 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/xberg/src/core/image_encode.rs:287 β€” crates/xberg/src/core/image_encode.rs:287-294 | crates/xberg/src/extraction/diagram/svg/mod.rs:52-59 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) crates/xberg/src/extraction/docx/drawing.rs:350 β€” crates/xberg/src/extraction/docx/drawing.rs:350-357 | crates/xberg/src/extraction/docx/table/mod.rs:779-786 β€” 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/xberg/src/extraction/docx/table/mod.rs:230 β€” crates/xberg/src/extraction/docx/table/mod.rs:230-237 | crates/xberg/src/extraction/docx/table/mod.rs:404-411 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/email/mod.rs:307 β€” crates/xberg/src/extraction/email/mod.rs:307-314 | crates/xberg/src/extraction/email/msg.rs:280-287 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) crates/xberg/src/extraction/excel/open.rs:714 β€” crates/xberg/src/extraction/excel/open.rs:714-721 | crates/xberg/src/extraction/excel/open.rs:739-746 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/pptx/mod.rs:611 β€” crates/xberg/src/extraction/pptx/mod.rs:611-618 | crates/xberg/src/extractors/docx.rs:577-584 β€” 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/xberg/src/extractors/docx.rs:1384 β€” crates/xberg/src/extractors/docx.rs:1384-1391 | crates/xberg/src/extractors/rtf/mod.rs:415-422 β€” 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/xberg/src/extractors/pdf/ocr/pipeline.rs:1444 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1444-1451 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1590-1597 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pptx.rs:491 β€” crates/xberg/src/extractors/pptx.rs:491-498 | crates/xberg/src/extractors/pptx.rs:615-622 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:368 β€” crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:368-375 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:728-735 β€” before extracting anything, compare `crates/xberg/src/extractors/rtf/parser/formatting_extract.rs` and `crates/xberg/src/extractors/rtf/parser/text_extract.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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.
  • + 18 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (12 lines × 2) Β· Γ—41
  • Duplicated block (12 lines × 2) crates/xberg-gliner/src/session.rs:46 β€” crates/xberg-gliner/src/session.rs:46-57 | crates/xberg-paddle-ocr/src/inference/ort_backend.rs:65-76 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/xberg-native-pdf/src/content/parser.rs:2207 β€” crates/xberg-native-pdf/src/content/parser.rs:2207-2218 | crates/xberg-native-pdf/src/content/parser.rs:2796-2807 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/extractors/ccitt_bilevel.rs:237 β€” crates/xberg-native-pdf/src/extractors/ccitt_bilevel.rs:237-248 | crates/xberg-native-pdf/src/extractors/ccitt_bilevel.rs:254-265 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/xberg-native-pdf/src/extractors/images.rs:2280 β€” crates/xberg-native-pdf/src/extractors/images.rs:2280-2291 | crates/xberg-native-pdf/src/extractors/images.rs:2325-2336 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/redaction/text_engine.rs:313 β€” crates/xberg-native-pdf/src/redaction/text_engine.rs:313-324 | crates/xberg-native-pdf/src/redaction/text_engine.rs:327-338 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:2593 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2593-2604 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2069-2080 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (12 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3252 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:3252-3263 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3370-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 (12 lines × 2) crates/xberg-native-pdf/src/structure/traversal.rs:319 β€” crates/xberg-native-pdf/src/structure/traversal.rs:319-330 | crates/xberg-native-pdf/src/structure/traversal.rs:450-461 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/font_provider.rs:135 β€” crates/xberg-pdfium-render/src/font_provider.rs:135-146 | crates/xberg-pdfium-render/src/font_provider.rs:197-208 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:368 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:368-379 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:430-441 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:395 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:395-406 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:457-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.
  • Duplicated block (12 lines × 2) crates/xberg-tesseract/src/api.rs:1631 β€” crates/xberg-tesseract/src/api.rs:1631-1642 | crates/xberg-tesseract/src/api.rs:1717-1728 β€” both copies are in the same file, so extract the 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/xberg/src/cache/core.rs:299 β€” crates/xberg/src/cache/core.rs:299-310 | crates/xberg/src/ocr/cache.rs:225-236 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) crates/xberg/src/core/pipeline/mod.rs:454 β€” crates/xberg/src/core/pipeline/mod.rs:454-465 | crates/xberg/src/core/pipeline/mod.rs:792-803 β€” both copies are in the same file, so extract the 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/xberg/src/core/pipeline/mod.rs:1380 β€” crates/xberg/src/core/pipeline/mod.rs:1380-1391 | crates/xberg/src/core/pipeline/mod.rs:1442-1453 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/archive/sevenz.rs:95 β€” crates/xberg/src/extraction/archive/sevenz.rs:95-106 | crates/xberg/src/extraction/archive/sevenz.rs:179-190 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/xberg/src/extraction/derive/mod.rs:178 β€” crates/xberg/src/extraction/derive/mod.rs:178-189 | crates/xberg/src/extraction/derive/mod.rs:286-297 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/parser.rs:2968 β€” crates/xberg/src/extraction/docx/parser.rs:2968-2979 | crates/xberg/src/extraction/docx/parser.rs:3129-3140 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/pptx/parser.rs:139 β€” crates/xberg/src/extraction/pptx/parser.rs:139-150 | crates/xberg/src/extraction/pptx/parser.rs:621-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.
  • Duplicated block (12 lines × 2) crates/xberg/src/extractors/docx.rs:558 β€” crates/xberg/src/extractors/docx.rs:558-569 | crates/xberg/src/extractors/odt.rs:1257-1268 β€” before extracting anything, compare `crates/xberg/src/extractors/docx.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 141 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 (12 lines × 2) crates/xberg/src/extractors/orgmode.rs:538 β€” crates/xberg/src/extractors/orgmode.rs:538-549 | crates/xberg/src/extractors/orgmode.rs:581-592 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pst.rs:71 β€” crates/xberg/src/extractors/pst.rs:71-82 | crates/xberg/src/extractors/pst.rs:188-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.
  • Duplicated block (12 lines × 2) crates/xberg/src/extractors/rtf/parser/mod.rs:123 β€” crates/xberg/src/extractors/rtf/parser/mod.rs:123-134 | crates/xberg/src/extractors/rtf/parser/mod.rs:185-196 β€” both copies are in the same file, so extract the 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/xberg/src/layout/models/rtdetr.rs:143 β€” crates/xberg/src/layout/models/rtdetr.rs:143-154 | crates/xberg/src/layout/models/rtdetr.rs:406-417 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/xberg/src/layout/types.rs:130 β€” crates/xberg/src/layout/types.rs:130-141 | crates/xberg/src/layout/types.rs:157-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.
  • + 16 more in this group β€” see findings.md.
D31 Β· IaC & Container Security Β· Medium IaC Β· Γ—28
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 3 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (11 lines × 2) Β· Γ—28
  • Duplicated block (11 lines × 2) crates/xberg-paddle-ocr/src/inference/ort_backend.rs:136 β€” crates/xberg-paddle-ocr/src/inference/ort_backend.rs:136-146 | crates/xberg-paddle-ocr/src/inference/tract_backend.rs:118-128 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) crates/xberg-pdfium-render/src/font_provider.rs:152 β€” crates/xberg-pdfium-render/src/font_provider.rs:152-162 | crates/xberg-pdfium-render/src/font_provider.rs:167-177 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:252 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:252-262 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/private.rs:266-276 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/size.rs:277 β€” crates/xberg-pdfium-render/src/pdf/document/page/size.rs:277-287 | crates/xberg-pdfium-render/src/pdf/document/page/size.rs:335-345 β€” both copies are in the same file, so extract the 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/xberg/src/api/jobs.rs:125 β€” crates/xberg/src/api/jobs.rs:125-135 | crates/xberg/src/api/jobs.rs:148-158 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/xberg/src/api/startup.rs:16 β€” crates/xberg/src/api/startup.rs:16-26 | crates/xberg/src/mcp/server.rs:1107-1117 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) crates/xberg/src/embeddings/engine.rs:186 β€” crates/xberg/src/embeddings/engine.rs:186-196 | crates/xberg/src/embeddings/engine.rs:226-236 β€” both copies are in the same file, so extract the 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/xberg/src/engine/extract_impl.rs:1574 β€” crates/xberg/src/engine/extract_impl.rs:1574-1584 | crates/xberg/src/engine/extract_impl.rs:1613-1623 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/parser.rs:675 β€” crates/xberg/src/extraction/docx/parser.rs:675-685 | crates/xberg/src/extraction/docx/parser.rs:690-700 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/parser.rs:2881 β€” crates/xberg/src/extraction/docx/parser.rs:2881-2891 | crates/xberg/src/extraction/docx/parser.rs:3026-3036 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/excel/package_metadata.rs:194 β€” crates/xberg/src/extraction/excel/package_metadata.rs:194-204 | crates/xberg/src/extraction/pptx/metadata.rs:124-134 β€” before extracting anything, compare `crates/xberg/src/extraction/excel/package_metadata.rs` and `crates/xberg/src/extraction/pptx/metadata.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/xberg/src/extraction/transform/content.rs:428 β€” crates/xberg/src/extraction/transform/content.rs:428-438 | crates/xberg/src/extraction/transform/mod.rs:281-291 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) crates/xberg/src/extractors/docbook.rs:964 β€” crates/xberg/src/extractors/docbook.rs:964-974 | crates/xberg/src/extractors/docbook.rs:1272-1282 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/fictionbook.rs:110 β€” crates/xberg/src/extractors/fictionbook.rs:110-120 | crates/xberg/src/extractors/jats/parser.rs:86-96 β€” before extracting anything, compare `crates/xberg/src/extractors/fictionbook.rs` and `crates/xberg/src/extractors/jats/parser.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/xberg/src/extractors/jupyter.rs:737 β€” crates/xberg/src/extractors/jupyter.rs:737-747 | crates/xberg/src/extractors/jupyter.rs:779-789 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/ocr/pipeline.rs:3429 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3429-3439 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3650-3660 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/rtf/parser/formatting_extract.rs:168 β€” crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:168-178 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:216-226 β€” before extracting anything, compare `crates/xberg/src/extractors/rtf/parser/formatting_extract.rs` and `crates/xberg/src/extractors/rtf/parser/text_extract.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/xberg/src/image/dpi.rs:32 β€” crates/xberg/src/image/dpi.rs:32-42 | crates/xberg/src/image/dpi.rs:67-77 β€” both copies are in the same file, so extract the 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/xberg/src/layout/models/pp_doclayout_v3.rs:458 β€” crates/xberg/src/layout/models/pp_doclayout_v3.rs:458-468 | crates/xberg/src/layout/models/rtdetr.rs:391-401 β€” before extracting anything, compare `crates/xberg/src/layout/models/pp_doclayout_v3.rs` and `crates/xberg/src/layout/models/rtdetr.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/xberg/src/pdf/structure/classify.rs:977 β€” crates/xberg/src/pdf/structure/classify.rs:977-987 | crates/xberg/src/pdf/structure/layout_classify.rs:339-349 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/classify.rs` and `crates/xberg/src/pdf/structure/layout_classify.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) crates/xberg/src/reranking/mod.rs:776 β€” crates/xberg/src/reranking/mod.rs:776-786 | crates/xberg/src/reranking/mod.rs:909-919 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/fdf/fdf_writer.rs:159 β€” crates/xberg-native-pdf/src/fdf/fdf_writer.rs:159-169 | crates/xberg-native-pdf/src/fdf/xfdf_writer.rs:41-51 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) crates/xberg/src/ocr/conversion.rs:325 β€” crates/xberg/src/ocr/conversion.rs:325-335 | crates/xberg/src/sceptre_ocr/blocks.rs:176-186 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) tools/benchmark-harness/src/validate_artifacts/aggregate_contract.rs:574 β€” tools/benchmark-harness/src/validate_artifacts/aggregate_contract.rs:574-584 | tools/benchmark-harness/src/validate_artifacts/raw_artifacts.rs:359-369 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2146 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2146-2156 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2359-2369 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • + 3 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (14 lines × 2) Β· Γ—27
  • Duplicated block (14 lines × 2) crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:164 β€” crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:164-177 | crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:248-261 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/xberg-native-pdf/src/fonts/font_dict.rs:3719 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:3719-3732 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3785-3798 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/outline.rs:83 β€” crates/xberg-native-pdf/src/outline.rs:83-96 | crates/xberg-native-pdf/src/outline.rs:131-144 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5882 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5882-5895 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6481-6494 β€” both copies are in the same file, so extract the 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/xberg-pdfium-render/src/pdf/document/page/object/group.rs:181 β€” crates/xberg-pdfium-render/src/pdf/document/page/object/group.rs:181-194 | crates/xberg-pdfium-render/src/pdf/document/page/object/group.rs:227-240 β€” both copies are in the same file, so extract the 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/xberg/src/chunking/validation.rs:130 β€” crates/xberg/src/chunking/validation.rs:130-143 | crates/xberg/src/chunking/validation.rs:182-195 β€” both copies are in the same file, so extract the 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/xberg/src/embeddings/mod.rs:723 β€” crates/xberg/src/embeddings/mod.rs:723-736 | crates/xberg/src/embeddings/mod.rs:1032-1045 β€” both copies are in the same file, so extract the 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/xberg/src/engine/extract_impl.rs:1559 β€” crates/xberg/src/engine/extract_impl.rs:1559-1572 | crates/xberg/src/engine/extract_impl.rs:1598-1611 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/math/collect.rs:23 β€” crates/xberg/src/extraction/docx/math/collect.rs:23-36 | crates/xberg/src/extraction/docx/math/elements.rs:864-877 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/xberg/src/extraction/docx/parser.rs:767 β€” crates/xberg/src/extraction/docx/parser.rs:767-780 | crates/xberg/src/extraction/docx/parser.rs:785-798 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/djot_format/extractor.rs:419 β€” crates/xberg/src/extractors/djot_format/extractor.rs:419-432 | crates/xberg/src/extractors/djot_format/extractor.rs:451-464 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/odp.rs:389 β€” crates/xberg/src/extractors/odp.rs:389-402 | crates/xberg/src/extractors/odt.rs:540-553 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 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 (14 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:634 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:634-647 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:666-679 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/ocr/pipeline.rs:1418 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1418-1431 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2938-2951 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/ocr/scoring.rs:675 β€” crates/xberg/src/extractors/pdf/ocr/scoring.rs:675-688 | crates/xberg/src/extractors/pdf/ocr/scoring.rs:716-729 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pst.rs:55 β€” crates/xberg/src/extractors/pst.rs:55-68 | crates/xberg/src/extractors/pst.rs:172-185 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/rst.rs:603 β€” crates/xberg/src/extractors/rst.rs:603-616 | crates/xberg/src/extractors/rst.rs:667-680 β€” both copies are in the same file, so extract the 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/xberg/src/layout/models/yolo.rs:118 β€” crates/xberg/src/layout/models/yolo.rs:118-131 | crates/xberg/src/layout/models/yolo.rs:241-254 β€” both copies are in the same file, so extract the 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/xberg/src/ocr/processor/mod.rs:61 β€” crates/xberg/src/ocr/processor/mod.rs:61-74 | crates/xberg/src/ocr/processor/mod.rs:96-109 β€” both copies are in the same file, so extract the 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/xberg/src/ocr/shaded_rows.rs:162 β€” crates/xberg/src/ocr/shaded_rows.rs:162-175 | crates/xberg/src/ocr/shaded_rows.rs:176-189 β€” both copies are in the same file, so extract the 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/xberg/src/pdf/table_reconstruct.rs:1021 β€” crates/xberg/src/pdf/table_reconstruct.rs:1021-1034 | crates/xberg/src/pdf/table_reconstruct.rs:1138-1151 β€” both copies are in the same file, so extract the 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/xberg/src/rendering/common.rs:536 β€” crates/xberg/src/rendering/common.rs:536-549 | crates/xberg/src/rendering/comrak_bridge.rs:51-64 β€” 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 (14 lines × 2) crates/xberg/src/rendering/comrak_bridge.rs:1437 β€” crates/xberg/src/rendering/comrak_bridge.rs:1437-1450 | crates/xberg/src/rendering/comrak_bridge.rs:1457-1470 β€” both copies are in the same file, so extract the 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/xberg/src/reranking/mod.rs:741 β€” crates/xberg/src/reranking/mod.rs:741-754 | crates/xberg/src/reranking/mod.rs:885-898 β€” both copies are in the same file, so extract the 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/xberg/src/plugins/ocr.rs:865 β€” crates/xberg/src/plugins/ocr.rs:865-878 | crates/xberg/src/plugins/renderer.rs:166-179 β€” before extracting anything, compare `crates/xberg/src/plugins/ocr.rs` and `crates/xberg/src/plugins/renderer.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
  • + 2 more in this group β€” see findings.md.
D4 Β· Code Duplication Β· Duplicated block (13 lines × 2) Β· Γ—27
  • Duplicated block (13 lines × 2) crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:105 β€” crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:105-117 | crates/xberg-candle-ocr/src/models/glm_ocr/mtp.rs:234-246 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/xberg-cli/src/commands/chunk.rs:21 β€” crates/xberg-cli/src/commands/chunk.rs:21-33 | crates/xberg-cli/src/commands/chunk.rs:38-50 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/content/parser.rs:458 β€” crates/xberg-native-pdf/src/content/parser.rs:458-470 | crates/xberg-native-pdf/src/content/parser.rs:2073-2085 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/elements/path.rs:71 β€” crates/xberg-native-pdf/src/elements/path.rs:71-83 | crates/xberg-native-pdf/src/elements/path.rs:752-764 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/structure/spatial_table_detector.rs:3923 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3923-3935 | crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3941-3953 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/structure/traversal.rs:342 β€” crates/xberg-native-pdf/src/structure/traversal.rs:342-354 | crates/xberg-native-pdf/src/structure/traversal.rs:421-434 β€” both copies are in the same file, so extract the 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/xberg/src/api/handlers.rs:1140 β€” crates/xberg/src/api/handlers.rs:1140-1152 | crates/xberg/src/mcp/server.rs:592-604 β€” 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 (13 lines × 2) crates/xberg/src/chunking/yaml_section.rs:95 β€” crates/xberg/src/chunking/yaml_section.rs:95-107 | crates/xberg/src/chunking/yaml_section.rs:112-124 β€” both copies are in the same file, so extract the 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/xberg/src/engine/extract_impl.rs:903 β€” crates/xberg/src/engine/extract_impl.rs:903-915 | crates/xberg/src/engine/extract_impl.rs:928-940 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/theme.rs:183 β€” crates/xberg/src/extraction/docx/theme.rs:183-195 | crates/xberg/src/extraction/docx/theme.rs:226-238 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/xberg/src/extractors/djot_format/extractor.rs:469 β€” crates/xberg/src/extractors/djot_format/extractor.rs:469-481 | crates/xberg/src/extractors/djot_format/extractor.rs:489-501 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/jats/mod.rs:282 β€” crates/xberg/src/extractors/jats/mod.rs:282-294 | crates/xberg/src/extractors/jats/mod.rs:384-396 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/mod.rs:2627 β€” crates/xberg/src/extractors/pdf/mod.rs:2627-2639 | crates/xberg/src/extractors/pdf/mod.rs:2899-2911 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/ocr/pipeline.rs:3535 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3535-3547 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3927-3939 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/reading_order.rs:525 β€” crates/xberg/src/extractors/pdf/reading_order.rs:525-537 | crates/xberg/src/extractors/pdf/reading_order.rs:576-588 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/typst.rs:608 β€” crates/xberg/src/extractors/typst.rs:608-620 | crates/xberg/src/extractors/typst.rs:743-755 β€” both copies are in the same file, so extract the 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/xberg/src/formula_recognition/mod.rs:150 β€” crates/xberg/src/formula_recognition/mod.rs:150-162 | crates/xberg/src/paddle_ocr/model_manager.rs:498-510 β€” 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 (13 lines × 2) crates/xberg/src/layout/models/slanet.rs:439 β€” crates/xberg/src/layout/models/slanet.rs:439-451 | crates/xberg/src/layout/models/table_classifier.rs:198-210 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) crates/xberg/src/ocr/processor/execution.rs:609 β€” crates/xberg/src/ocr/processor/execution.rs:609-621 | crates/xberg/src/ocr/processor/execution.rs:666-678 β€” both copies are in the same file, so extract the 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/xberg/src/ocr/tesseract_backend.rs:416 β€” crates/xberg/src/ocr/tesseract_backend.rs:416-428 | crates/xberg/src/ocr/tesseract_backend.rs:515-527 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) crates/xberg/src/text/redaction/engine.rs:534 β€” crates/xberg/src/text/redaction/engine.rs:534-546 | crates/xberg/src/text/redaction/engine.rs:566-578 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/separation_renderer.rs:895 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:895-917 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:938-950 β€” both copies are in the same file, so extract the 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/xberg/src/candle_ocr/deepseek_ocr_backend.rs:354 β€” crates/xberg/src/candle_ocr/deepseek_ocr_backend.rs:354-366 | crates/xberg/src/candle_ocr/paddleocr_vl_backend.rs:312-324 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) crates/xberg/src/extraction/docx/math/elements.rs:212 β€” crates/xberg/src/extraction/docx/math/elements.rs:212-224 | crates/xberg/src/extraction/docx/math/elements.rs:304-316 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/archive/tar.rs:165 β€” crates/xberg/src/extraction/archive/tar.rs:165-177 | crates/xberg/src/extraction/archive/zip.rs:160-172 β€” before extracting anything, compare `crates/xberg/src/extraction/archive/tar.rs` and `crates/xberg/src/extraction/archive/zip.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
  • + 2 more in this group β€” see findings.md.
D3 Β· God Classes Β· ClassTooLong Β· Γ—26
  • ClassTooLong: DynamicPdfiumBindings crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:35 β€” ClassTooLong β€” 4527 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 3 methods, 4 blocks, lines 35-6018. The bar is 400 significant lines; this is 4127 over it, 11.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: PageRenderer crates/xberg-native-pdf/src/rendering/page_renderer.rs:207 β€” ClassTooLong β€” 4029 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, 2 blocks, lines 207-7465. The bar is 400 significant lines; this is 3629 over it, 10.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StaticPdfiumBindings crates/xberg-pdfium-render/src/bindings/static_bindings.rs:32 β€” ClassTooLong β€” 2822 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 1 methods, 4 blocks, lines 34-3832. The bar is 400 significant lines; this is 2422 over it, 7.06× 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: FontInfo crates/xberg-native-pdf/src/fonts/font_dict.rs:47 β€” ClassTooLong β€” 2206 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 47-5278. The bar is 400 significant lines; this is 1806 over it, 5.52× 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: PdfiumLibraryBindings crates/xberg-pdfium-render/src/bindings.rs:98 β€” ClassTooLong β€” 2051 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 488 methods. The bar is 400 significant lines; this is 1651 over it, 5.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.
  • ClassTooLong: RstExtractor crates/xberg/src/extractors/rst.rs:61 β€” ClassTooLong β€” 1105 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 23 methods, 4 blocks, lines 203-1843. The bar is 400 significant lines; this is 705 over it, 2.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PdfExtractor crates/xberg/src/extractors/pdf/mod.rs:2089 β€” ClassTooLong β€” 1021 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 4 methods, 5 blocks, lines 2089-3581. The bar is 400 significant lines; this is 621 over it, 2.55× 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: XYCutStrategy crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:231 β€” ClassTooLong β€” 995 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 27 methods, 4 blocks, lines 231-2571. The bar is 400 significant lines; this is 595 over it, 2.49× 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: JupyterExtractor crates/xberg/src/extractors/jupyter.rs:75 β€” ClassTooLong β€” 959 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 45 methods, 4 blocks, lines 102-1534. The bar is 400 significant lines; this is 559 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DocxParser crates/xberg/src/extraction/docx/parser.rs:2416 β€” ClassTooLong β€” 927 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 12 methods, 2 blocks, lines 2416-3808. The bar is 400 significant lines; this is 527 over it, 2.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: TextRasterizer crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:426 β€” ClassTooLong β€” 850 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 21 methods, 3 blocks, lines 426-1939. The bar is 400 significant lines; this is 450 over it, 2.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.
  • ClassTooLong: PaddleOcrBackend crates/xberg/src/paddle_ocr/backend.rs:417 β€” ClassTooLong β€” 797 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 34 methods, 5 blocks, lines 417-1837. The bar is 400 significant lines; this is 397 over it, 1.99× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TesseractAPI crates/xberg-tesseract/src/api.rs:113 β€” ClassTooLong β€” 781 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 69 methods, 5 blocks, lines 113-1825. The bar is 400 significant lines; this is 381 over it, 1.95× 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: FictionBookExtractor crates/xberg/src/extractors/fictionbook.rs:38 β€” ClassTooLong β€” 766 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 10 methods, 4 blocks, lines 40-1182. The bar is 400 significant lines; this is 366 over it, 1.92× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: OrgModeExtractor crates/xberg/src/extractors/orgmode.rs:58 β€” ClassTooLong β€” 752 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 61-1232. The bar is 400 significant lines; this is 352 over it, 1.88× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MarkdownExtractor crates/xberg/src/extractors/markdown.rs:102 β€” ClassTooLong β€” 716 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 3 methods, 4 blocks, lines 104-1089. The bar is 400 significant lines; this is 316 over it, 1.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PaddleOcrEngine crates/xberg-paddle-ocr/src/ocr_lite.rs:123 β€” ClassTooLong β€” 635 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 31 methods, 3 blocks, lines 123-973. The bar is 400 significant lines; this is 235 over it, 1.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: TypstExtractor crates/xberg/src/extractors/typst.rs:65 β€” ClassTooLong β€” 608 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 19 methods, 4 blocks, lines 65-1020. The bar is 400 significant lines; this is 208 over it, 1.52× 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: XbergMcp crates/xberg/src/mcp/server.rs:89 β€” ClassTooLong β€” 552 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 12 methods, 6 blocks, lines 89-1057. The bar is 400 significant lines; this is 152 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: DjotExtractor crates/xberg/src/extractors/djot_format/extractor.rs:26 β€” ClassTooLong β€” 550 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 2 methods, 5 blocks, lines 28-797. The bar is 400 significant lines; this is 150 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: ImageExtractor crates/xberg/src/extractors/image.rs:2828 β€” ClassTooLong β€” 543 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 7 methods, 4 blocks, lines 2830-3936. The bar is 400 significant lines; this is 143 over it, 1.36× 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: PdfPagePathObject crates/xberg-pdfium-render/src/pdf/document/page/object/path.rs:174 β€” ClassTooLong β€” 490 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, 4 blocks, lines 174-997. The bar is 400 significant lines; this is 90 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.
  • ClassTooLong: ExtractionConfig crates/xberg/src/core/config/extraction/core.rs:38 β€” ClassTooLong β€” 479 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 41 methods, 4 blocks, lines 38-1209. The bar is 400 significant lines; this is 79 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.
  • ClassTooLong: EpubExtractor crates/xberg/src/extractors/epub/mod.rs:45 β€” ClassTooLong β€” 470 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 6 methods, 5 blocks, lines 47-840. The bar is 400 significant lines; this is 70 over it, 1.18× 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: PptxExtractor crates/xberg/src/extractors/pptx.rs:19 β€” ClassTooLong β€” 448 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code β€” #[cfg(test)] modules and bare #[test] functions β€” not counted), 10 methods, 6 blocks, lines 27-665. The bar is 400 significant lines; this is 48 over it, 1.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 1 more in this group β€” see findings.md.
X3 Β· Exception handling Β· Swallowed exception (empty catch) Β· Γ—25
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:430 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:436 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:485 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:491 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:518 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:563 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:569 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:614 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:620 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:667 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:673 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:702 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:728 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:754 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:780 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:825 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:831 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:876 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:882 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:931 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:937 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:1422 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:1467 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:1473 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/csharp/src/Xberg/TraitBridges.cs:1503 β€” An empty catch block silently discards the error β€” failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
D2 Β· Cognitive Complexity Β· benchmark_harness Β· Γ—24
  • benchmark_harness::commands::run::register_external_adapters (cognitive 99) tools/benchmark-harness/src/commands/run.rs:567 β€” benchmark_harness::commands::run::register_external_adapters has cognitive complexity 99 (threshold 15). Drivers by points: if/else 32 (70 pts), match/switch 10 (29 pts) (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::sizes::package_measurements::measure_jar (cognitive 30) tools/benchmark-harness/src/sizes/package_measurements.rs:262 β€” benchmark_harness::sizes::package_measurements::measure_jar has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::noise_detection::detect_garbled_text (cognitive 26) tools/benchmark-harness/src/noise_detection/mod.rs:357 β€” benchmark_harness::noise_detection::detect_garbled_text has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::commands::validate_gt::print_issue_lists (cognitive 25) tools/benchmark-harness/src/commands/validate_gt.rs:16 β€” benchmark_harness::commands::validate_gt::print_issue_lists has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 5 (10 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • benchmark_harness::noise_detection::find_code_ranges (cognitive 24) tools/benchmark-harness/src/noise_detection/mod.rs:127 β€” benchmark_harness::noise_detection::find_code_ranges has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), boolean chains 5 (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.
  • benchmark_harness::sizes::package_measurements::parse_pip_show_size (cognitive 23) tools/benchmark-harness/src/sizes/package_measurements.rs:67 β€” benchmark_harness::sizes::package_measurements::parse_pip_show_size has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::sizes::package_measurements::measure_gem_package (cognitive 22) tools/benchmark-harness/src/sizes/package_measurements.rs:331 β€” benchmark_harness::sizes::package_measurements::measure_gem_package has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, 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.
  • benchmark_harness::adapters::external::get_tika_jar_path (cognitive 21) tools/benchmark-harness/src/adapters/external.rs:435 β€” benchmark_harness::adapters::external::get_tika_jar_path has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::aggregate::ranking::collect_pdf_metrics (cognitive 21) tools/benchmark-harness/src/aggregate/ranking.rs:429 β€” benchmark_harness::aggregate::ranking::collect_pdf_metrics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (8 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::adapters::subprocess::batch_exec::align_xberg_batch_output (cognitive 20) tools/benchmark-harness/src/adapters/subprocess/batch_exec.rs:39 β€” benchmark_harness::adapters::subprocess::batch_exec::align_xberg_batch_output has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::noise_detection::detect_header_footer_repetition (cognitive 20) tools/benchmark-harness/src/noise_detection/mod.rs:648 β€” benchmark_harness::noise_detection::detect_header_footer_repetition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::aggregate::ranking::build_shared_corpus_quality_ranking (cognitive 19) tools/benchmark-harness/src/aggregate/ranking.rs:107 β€” benchmark_harness::aggregate::ranking::build_shared_corpus_quality_ranking has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 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.
  • benchmark_harness::json_quality::field_precision_recall_f1 (cognitive 19) tools/benchmark-harness/src/json_quality.rs:134 β€” benchmark_harness::json_quality::field_precision_recall_f1 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2, boolean chains 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. This shape REPEATS in the file: one other method here (benchmark_harness::json_quality::field_precision_recall_f1_normalized) 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.
  • benchmark_harness::json_quality::field_precision_recall_f1_normalized (cognitive 19) tools/benchmark-harness/src/json_quality.rs:340 β€” benchmark_harness::json_quality::field_precision_recall_f1_normalized has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 2, boolean chains 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. This shape REPEATS in the file: one other method here (benchmark_harness::json_quality::field_precision_recall_f1) 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.
  • benchmark_harness::output::validate_result (cognitive 19) tools/benchmark-harness/src/output.rs:21 β€” benchmark_harness::output::validate_result has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::sizes::package_measurements::measure_binary (cognitive 19) tools/benchmark-harness/src/sizes/package_measurements.rs:202 β€” benchmark_harness::sizes::package_measurements::measure_binary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), boolean chains 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.
  • benchmark_harness::comparison::extraction_config::apply_fixture_ocr_language (cognitive 18) tools/benchmark-harness/src/comparison/extraction_config.rs:610 β€” benchmark_harness::comparison::extraction_config::apply_fixture_ocr_language has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 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.
  • benchmark_harness::comparison::guardrails::validate_guardrails_config (cognitive 18) tools/benchmark-harness/src/comparison/guardrails.rs:57 β€” benchmark_harness::comparison::guardrails::validate_guardrails_config has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::validate_gt::validate_ground_truth (cognitive 18) tools/benchmark-harness/src/validate_gt.rs:184 β€” benchmark_harness::validate_gt::validate_ground_truth has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::noise_detection::detect_excessive_heading_density (cognitive 17) tools/benchmark-harness/src/noise_detection/mod.rs:810 β€” benchmark_harness::noise_detection::detect_excessive_heading_density 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.
  • benchmark_harness::pipeline_benchmark::compute_aggregates (cognitive 17) tools/benchmark-harness/src/pipeline_benchmark/mod.rs:592 β€” benchmark_harness::pipeline_benchmark::compute_aggregates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 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.
  • benchmark_harness::split_benchmark::run_threshold_sweep (cognitive 17) tools/benchmark-harness/src/split_benchmark.rs:365 β€” benchmark_harness::split_benchmark::run_threshold_sweep has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (7 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.
  • benchmark_harness::aggregate::ranking::build_deltas_vs_baseline (cognitive 16) tools/benchmark-harness/src/aggregate/ranking.rs:385 β€” benchmark_harness::aggregate::ranking::build_deltas_vs_baseline has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • benchmark_harness::noise_detection::detect_broken_tables (cognitive 16) tools/benchmark-harness/src/noise_detection/mod.rs:463 β€” benchmark_harness::noise_detection::detect_broken_tables has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
D3 Β· God Classes Β· TooManyMethods Β· Γ—24
  • TooManyMethods: PdfDocument crates/xberg-native-pdf/src/document/mod.rs:558 β€” TooManyMethods β€” 364 methods, declared across 21 files: document/extract_api.rs (40), document/columns.rs (30), document/spans_text.rs (27), document/fonts.rs (24), +17 more file(s). The bar is 30 methods; this is 334 over it, 12.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TextExtractor crates/xberg-native-pdf/src/extractors/text/mod.rs:2137 β€” TooManyMethods β€” 101 methods, declared across 11 files: text/setup.rs (18), text/marked_content.rs (17), text/span_ordering.rs (17), text/tj_arrays.rs (11), +7 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: PageRenderer crates/xberg-native-pdf/src/rendering/page_renderer.rs:207 β€” 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: TesseractAPI crates/xberg-tesseract/src/api.rs:113 β€” TooManyMethods β€” 69 methods. The bar is 30 methods; this is 39 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.
  • TooManyMethods: SubprocessAdapter tools/benchmark-harness/src/adapters/subprocess.rs:27 β€” TooManyMethods β€” 69 methods, declared across 6 files: subprocess/batch_exec.rs (21), adapters/subprocess.rs (15), subprocess/process_exec.rs (12), subprocess/args.rs (9), +2 more file(s). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: InternalDocumentBuilder crates/xberg/src/types/internal_builder.rs:43 β€” 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: FontInfo crates/xberg-native-pdf/src/fonts/font_dict.rs:47 β€” 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: PdfFont crates/xberg-pdfium-render/src/pdf/font.rs:95 β€” TooManyMethods β€” 52 methods, declared across 2 files: pdf/font.rs (38), font/deprecated_builtin.rs (14). The bar is 30 methods; this is 22 over it, 1.73× 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: PdfPage crates/xberg-pdfium-render/src/pdf/document/page.rs:179 β€” TooManyMethods β€” 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PdfPageGroupObject crates/xberg-pdfium-render/src/pdf/document/page/object/group.rs:40 β€” TooManyMethods β€” 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PdfRenderConfig crates/xberg-pdfium-render/src/pdf/document/page/render_config.rs:67 β€” 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: HtmlWalker crates/xberg/src/extraction/html/structure.rs:168 β€” TooManyMethods β€” 45 methods, declared across 2 files: structure/tag_handlers.rs (33), html/structure.rs (12). The bar is 30 methods; this is 15 over it, 1.50× 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: JupyterExtractor crates/xberg/src/extractors/jupyter.rs:75 β€” 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: PathExtractor crates/xberg-native-pdf/src/extractors/paths.rs:130 β€” 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: PdfPageTextChar crates/xberg-pdfium-render/src/pdf/document/page/text/char.rs:25 β€” TooManyMethods β€” 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExtractionConfig crates/xberg/src/core/config/extraction/core.rs:38 β€” TooManyMethods β€” 41 methods, declared across 3 files: extraction/core.rs (18), extraction/env.rs (16), extraction/loaders.rs (7). The bar is 30 methods; this is 11 over it, 1.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: PdfImage crates/xberg-native-pdf/src/extractors/images.rs:22 β€” TooManyMethods β€” 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ExtractionOverrides crates/xberg-cli/src/commands/overrides/mod.rs:54 β€” TooManyMethods β€” 37 methods, declared across 10 files: overrides/general.rs (10), overrides/ocr.rs (7), overrides/chunking.rs (4), overrides/output.rs (4), +6 more file(s). The bar is 30 methods; this is 7 over it, 1.23× 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: ImageHandle crates/xberg-libheif/src/image_handle.rs:23 β€” 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: PaddleOcrBackend crates/xberg/src/paddle_ocr/backend.rs:417 β€” TooManyMethods β€” 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: HeifContext crates/xberg-libheif/src/context.rs:26 β€” TooManyMethods β€” 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SecurityLimits crates/xberg-libheif/src/security_limits.rs:9 β€” TooManyMethods β€” 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PdfPageImageObject crates/xberg-pdfium-render/src/pdf/document/page/object/image.rs:59 β€” TooManyMethods β€” 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PaddleOcrEngine crates/xberg-paddle-ocr/src/ocr_lite.rs:123 β€” TooManyMethods β€” 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D2 Β· Cognitive Complexity Β· PageRenderer Β· Γ—19
  • PageRenderer::execute_operators (cognitive 358) crates/xberg-native-pdf/src/rendering/page_renderer.rs:966 β€” PageRenderer::execute_operators has cognitive complexity 358 (threshold 15). Drivers by points: if/else 100 (320 pts), match/switch 10 (31 pts), boolean chains 6, loops 1 (nesting depth added 241). 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.
  • PageRenderer::render_image (cognitive 241) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3629 β€” PageRenderer::render_image has cognitive complexity 241 (threshold 15). Drivers by points: if/else 40 (144 pts), loops 8 (53 pts), match/switch 6 (39 pts), boolean chains 5 (nesting depth added 182). 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.
  • PageRenderer::render_xobject (cognitive 80) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3507 β€” PageRenderer::render_xobject has cognitive complexity 80 (threshold 15). Drivers by points: if/else 16 (73 pts), match/switch 1 (7 pts) (nesting depth added 63). 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.
  • PageRenderer::render_annotations (cognitive 52) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7088 β€” PageRenderer::render_annotations has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (51 pts), loops 1 (nesting depth added 39). 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.
  • PageRenderer::fill_with_tiling_pattern (cognitive 42) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4505 β€” PageRenderer::fill_with_tiling_pattern has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22, loops 7 (10 pts), boolean chains 6, match/switch 4 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PageRenderer::rasterise_image_xobject_coverage (cognitive 38) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5390 β€” PageRenderer::rasterise_image_xobject_coverage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (38 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PageRenderer::execute_knockout_group (cognitive 38) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6915 β€” PageRenderer::execute_knockout_group has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageRenderer::load_resources (cognitive 34) crates/xberg-native-pdf/src/rendering/page_renderer.rs:749 β€” PageRenderer::load_resources has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (8 pts), match/switch 1 (5 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PageRenderer::apply_overprint_after_paint (cognitive 32) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6462 β€” PageRenderer::apply_overprint_after_paint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (25 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • PageRenderer::mirror_cmyk_paint_into_sidecar (cognitive 29) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4957 β€” PageRenderer::mirror_cmyk_paint_into_sidecar has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (17 pts), match/switch 4 (8 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • PageRenderer::apply_cmyk_compose_after_paint (cognitive 27) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5650 β€” PageRenderer::apply_cmyk_compose_after_paint has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageRenderer::render_form_xobject (cognitive 26) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4343 β€” PageRenderer::render_form_xobject has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 4 (7 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.
  • PageRenderer::apply_smask_after_paint_inner (cognitive 25) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6674 β€” PageRenderer::apply_smask_after_paint_inner has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (11 pts), match/switch 5 (8 pts), if/else 4 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageRenderer::render_image_mask (cognitive 23) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4198 β€” PageRenderer::render_image_mask has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (5 pts), match/switch 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageRenderer::mirror_spot_paint_into_sidecar_with_coverage (cognitive 23) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6328 β€” PageRenderer::mirror_spot_paint_into_sidecar_with_coverage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (3 pts), match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PageRenderer::render_type3_text (cognitive 22) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2828 β€” PageRenderer::render_type3_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4, boolean chains 1, loops 1 (nesting depth added 11). 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.
  • PageRenderer::render_shading (cognitive 21) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2990 β€” PageRenderer::render_shading has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 3 (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.
  • PageRenderer::mirror_cmyk_paint_into_sidecar_with_coverage (cognitive 18) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6186 β€” PageRenderer::mirror_cmyk_paint_into_sidecar_with_coverage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PageRenderer::apply_overprint_after_paint_with_coverage (cognitive 16) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5859 β€” PageRenderer::apply_overprint_after_paint_with_coverage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 Β· Code Duplication Β· Members sharing a duplicated core (4 members, 50+ identical tokens) Β· Γ—18
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg-native-pdf/src/extractors/hierarchical.rs:84 β€” crates/xberg-native-pdf/src/extractors/hierarchical.rs:84-128 | crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:198-221 | crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:224-246 | crates/xberg-native-pdf/src/structure/converter.rs:95-118 β€” 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/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:38 β€” crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:38-62 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:51-88 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_japan1.rs:34-54 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_korea1.rs:36-58 β€” 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/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:90 β€” crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:90-102 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:129-142 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_japan1.rs:78-91 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_korea1.rs:84-98 β€” 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/xberg-native-pdf/src/optional_content.rs:161 β€” crates/xberg-native-pdf/src/optional_content.rs:161-186 | crates/xberg-native-pdf/src/structure/parser.rs:102-127 | crates/xberg/src/pdf/native/metadata.rs:310-342 | crates/xberg/src/pdf/xref_revisions.rs:205-232 β€” 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/xberg-native-pdf/src/pipeline/config.rs:81 β€” crates/xberg-native-pdf/src/pipeline/config.rs:81-107 | crates/xberg-native-pdf/src/pipeline/config.rs:109-135 | crates/xberg-native-pdf/src/pipeline/config.rs:165-191 | crates/xberg-native-pdf/src/pipeline/config.rs:193-219 β€” 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/xberg-native-pdf/src/rendering/page_renderer.rs:4964 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4964-5076 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5575-5648 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5657-5815 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6194-6248 β€” 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/xberg-native-pdf/src/rendering/page_renderer.rs:5575 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5575-5648 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5657-5815 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5867-5946 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6469-6610 β€” 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/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:221 β€” crates/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:221-229 | crates/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:243-250 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2464-2478 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2488-2514 β€” 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/xberg-tesseract/src/api.rs:1497 β€” crates/xberg-tesseract/src/api.rs:1497-1529 | crates/xberg-tesseract/src/api.rs:1551-1583 | crates/xberg-tesseract/src/api.rs:1609-1668 | crates/xberg-tesseract/src/api.rs:1695-1748 β€” 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/xberg/src/embeddings/engine.rs:85 β€” crates/xberg/src/embeddings/engine.rs:85-164 | crates/xberg/src/late_interaction/engine.rs:169-227 | crates/xberg/src/reranking/engine.rs:227-289 | crates/xberg/src/sparse_embeddings/engine.rs:86-144 β€” These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/xberg/src/extraction/email/msg_props.rs:29 β€” crates/xberg/src/extraction/email/msg_props.rs:29-56 | crates/xberg/src/extraction/email/msg_props.rs:66-87 | crates/xberg/src/extraction/email/msg_props.rs:161-189 | crates/xberg/src/extraction/email/msg_props.rs:272-296 β€” 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/xberg/src/extractors/docbook.rs:164 β€” crates/xberg/src/extractors/docbook.rs:164-232 | crates/xberg/src/extractors/docbook.rs:1348-1404 | crates/xberg/src/extractors/fictionbook.rs:133-388 | crates/xberg/src/extractors/jats/parser.rs:108-327 β€” 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/xberg/src/extractors/docbook.rs:1129 β€” crates/xberg/src/extractors/docbook.rs:1129-1344 | crates/xberg/src/extractors/fictionbook.rs:673-847 | crates/xberg/src/extractors/jats/elements.rs:15-432 | crates/xberg/src/extractors/jats/parser.rs:108-327 β€” 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/xberg/src/extractors/docx.rs:919 β€” crates/xberg/src/extractors/docx.rs:919-1413 | crates/xberg/src/extractors/odp.rs:431-604 | crates/xberg/src/extractors/odt.rs:1640-1813 | crates/xberg/src/extractors/rtf/mod.rs:366-443 β€” 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/xberg/src/layout/models/pp_doclayout_v3.rs:257 β€” crates/xberg/src/layout/models/pp_doclayout_v3.rs:257-336 | crates/xberg/src/layout/models/pp_doclayout_v3.rs:455-518 | crates/xberg/src/layout/models/rtdetr.rs:118-186 | crates/xberg/src/layout/models/rtdetr.rs:388-435 β€” 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/xberg/src/pdf/structure/classify.rs:336 β€” crates/xberg/src/pdf/structure/classify.rs:336-434 | crates/xberg/src/pdf/structure/classify.rs:589-626 | crates/xberg/src/pdf/structure/layout_classify.rs:296-307 | crates/xberg/src/pdf/structure/layout_classify.rs:396-579 β€” 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/xberg/src/rendering/djot.rs:341 β€” crates/xberg/src/rendering/djot.rs:341-368 | crates/xberg/src/rendering/html.rs:36-63 | crates/xberg/src/rendering/markdown.rs:245-271 | crates/xberg/src/rendering/plain.rs:297-322 β€” 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) tools/generate_test_fixtures/src/generate_test_fixtures/odt_revisions.py:109 β€” tools/generate_test_fixtures/src/generate_test_fixtures/odt_revisions.py:109-121 | tools/generate_test_fixtures/src/generate_test_fixtures/pptx_comments.py:106-123 | tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:44-61 | tools/generate_test_fixtures/src/generate_test_fixtures/xlsx_revisions.py:92-109 β€” These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 Β· Code Duplication Β· Duplicated block (16 lines × 2) Β· Γ—16
  • Duplicated block (16 lines × 2) crates/xberg-native-pdf/src/document/tables.rs:74 β€” crates/xberg-native-pdf/src/document/tables.rs:74-89 | crates/xberg-native-pdf/src/document/tables.rs:170-185 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/extractors/synthetic_structure.rs:199 β€” crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:199-214 | crates/xberg-native-pdf/src/structure/converter.rs:96-111 β€” before extracting anything, compare `crates/xberg-native-pdf/src/extractors/synthetic_structure.rs` and `crates/xberg-native-pdf/src/structure/converter.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 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 (16 lines × 2) crates/xberg-native-pdf/src/text/kangxi.rs:87 β€” crates/xberg-native-pdf/src/text/kangxi.rs:87-102 | crates/xberg-native-pdf/src/text/kangxi.rs:133-148 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/xberg-tesseract/src/api.rs:1228 β€” crates/xberg-tesseract/src/api.rs:1228-1243 | crates/xberg-tesseract/src/api.rs:1271-1286 β€” both copies are in the same file, so extract the 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/xberg/src/core/pipeline/mod.rs:549 β€” crates/xberg/src/core/pipeline/mod.rs:549-564 | crates/xberg/src/core/pipeline/mod.rs:822-837 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) crates/xberg/src/extraction/doc/metadata.rs:132 β€” crates/xberg/src/extraction/doc/metadata.rs:132-147 | crates/xberg/src/extraction/ppt/mod.rs:1529-1544 β€” before extracting anything, compare `crates/xberg/src/extraction/doc/metadata.rs` and `crates/xberg/src/extraction/ppt/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 (16 lines × 2) crates/xberg/src/extraction/doc/mod.rs:957 β€” crates/xberg/src/extraction/doc/mod.rs:957-972 | crates/xberg/src/extraction/ppt/mod.rs:1409-1424 β€” `crates/xberg/src/extraction/doc/mod.rs` and `crates/xberg/src/extraction/ppt/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other β€” this scan matched 3 separate duplicated blocks between them, totalling at least 41 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (16 lines × 2) crates/xberg/src/extraction/docx/drawing.rs:536 β€” crates/xberg/src/extraction/docx/drawing.rs:536-551 | crates/xberg/src/extraction/docx/drawing.rs:588-603 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/djot_format/extractor.rs:575 β€” crates/xberg/src/extractors/djot_format/extractor.rs:575-590 | crates/xberg/src/extractors/markdown.rs:878-893 β€” before extracting anything, compare `crates/xberg/src/extractors/djot_format/extractor.rs` and `crates/xberg/src/extractors/markdown.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 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 (16 lines × 2) crates/xberg/src/extractors/docbook.rs:976 β€” crates/xberg/src/extractors/docbook.rs:976-991 | crates/xberg/src/extractors/docbook.rs:1284-1299 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/epub/mod.rs:492 β€” crates/xberg/src/extractors/epub/mod.rs:492-507 | crates/xberg/src/extractors/odt.rs:556-571 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) crates/xberg/src/extractors/jats/elements.rs:267 β€” crates/xberg/src/extractors/jats/elements.rs:267-282 | crates/xberg/src/extractors/jats/mod.rs:190-205 β€” before extracting anything, compare `crates/xberg/src/extractors/jats/elements.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) crates/xberg/src/extractors/latex/mod.rs:493 β€” crates/xberg/src/extractors/latex/mod.rs:493-508 | crates/xberg/src/extractors/latex/mod.rs:674-689 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/pdf/ocr/pipeline.rs:1135 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1135-1150 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1251-1266 β€” both copies are in the same file, so extract the 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/xberg/src/layout/models/pp_doclayout_v3.rs:275 β€” crates/xberg/src/layout/models/pp_doclayout_v3.rs:275-290 | crates/xberg/src/layout/models/pp_doclayout_v3.rs:473-488 β€” both copies are in the same file, so extract the 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/xberg/src/pdf/structure/lines.rs:122 β€” crates/xberg/src/pdf/structure/lines.rs:122-137 | tools/benchmark-harness/src/quality/mod.rs:388-406 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
X3 Β· Exception handling Β· Swallowed exception (caught, then discarded) Β· Γ—15
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/MetaSchema.cs:202 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/MetaSchema.cs:219 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/Registry.cs:203 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/Registry.cs:220 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TokenCounter.cs:202 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TokenCounter.cs:219 β€” `catch (global::System.Threading.ThreadInterruptedException)` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:424 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:479 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:557 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:608 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:661 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:819 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:870 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:925 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
  • Swallowed exception (caught, then discarded) packages/csharp/src/Xberg/TraitBridges.cs:1461 β€” `catch` does nothing with the exception it caught β€” the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch. Log it through whatever this codebase already uses to report problems, or let it propagate; if one specific failure genuinely cannot matter, catch exactly that exception type and say why in a comment on the catch.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 3) Β· Γ—14
  • Duplicated block (7 lines × 3) crates/xberg-native-pdf/src/content/parser.rs:109 β€” crates/xberg-native-pdf/src/content/parser.rs:109-116 | crates/xberg-native-pdf/src/content/parser.rs:462-468 | crates/xberg-native-pdf/src/content/parser.rs:2077-2083 β€” 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 (7 lines × 3) crates/xberg-native-pdf/src/layout/region_classifier.rs:96 β€” crates/xberg-native-pdf/src/layout/region_classifier.rs:96-102 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1260-1266 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1695-1701 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5051 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5051-5057 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5743-5749 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6543-6549 β€” 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 (7 lines × 3) crates/xberg/src/extraction/doc/metadata.rs:136 β€” crates/xberg/src/extraction/doc/metadata.rs:136-142 | crates/xberg/src/extraction/exif.rs:191-197 | crates/xberg/src/extraction/ppt/mod.rs:1533-1539 β€” before extracting anything, compare `crates/xberg/src/extraction/doc/metadata.rs` and `crates/xberg/src/extraction/ppt/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 (7 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs:298 β€” crates/xberg/src/extractors/djot_format/extractor.rs:298-304 | crates/xberg/src/extractors/djot_format/extractor.rs:306-312 | crates/xberg/src/extractors/djot_format/extractor.rs:314-320 β€” 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 (7 lines × 3) crates/xberg/src/extractors/docbook.rs:1139 β€” crates/xberg/src/extractors/docbook.rs:1139-1146 | crates/xberg/src/extractors/jats/mod.rs:72-79 | crates/xberg/src/extractors/jats/parser.rs:348-354 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 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 (7 lines × 3) crates/xberg/src/extractors/iwork/keynote.rs:204 β€” crates/xberg/src/extractors/iwork/keynote.rs:204-210 | crates/xberg/src/extractors/iwork/numbers.rs:1335-1341 | crates/xberg/src/extractors/iwork/pages.rs:167-173 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 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 (7 lines × 3) crates/xberg/src/extractors/jats/elements.rs:383 β€” crates/xberg/src/extractors/jats/elements.rs:383-389 | crates/xberg/src/extractors/jats/parser.rs:217-223 | crates/xberg/src/extractors/jats/parser.rs:405-411 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (7 lines × 3) crates/xberg/src/extractors/markdown.rs:478 β€” crates/xberg/src/extractors/markdown.rs:478-484 | crates/xberg/src/extractors/markdown.rs:486-492 | crates/xberg/src/extractors/markdown.rs:494-500 β€” 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 (7 lines × 3) crates/xberg/src/pdf/structure/classify.rs:381 β€” crates/xberg/src/pdf/structure/classify.rs:381-387 | crates/xberg/src/pdf/structure/classify.rs:399-405 | crates/xberg/src/pdf/structure/classify.rs:417-423 β€” 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 (7 lines × 3) crates/xberg/src/plugins/registry/embedding.rs:55 β€” crates/xberg/src/plugins/registry/embedding.rs:55-61 | crates/xberg/src/plugins/registry/reranker.rs:45-51 | crates/xberg/src/plugins/registry/tokenizer.rs:51-57 β€” 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 (7 lines × 3) crates/xberg/src/plugins/registry/embedding.rs:135 β€” crates/xberg/src/plugins/registry/embedding.rs:135-141 | crates/xberg/src/plugins/registry/ocr.rs:379-385 | crates/xberg/src/plugins/registry/tokenizer.rs:125-131 β€” 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 (7 lines × 3) tools/benchmark-harness/src/adapters/external.rs:159 β€” tools/benchmark-harness/src/adapters/external.rs:159-165 | tools/benchmark-harness/src/adapters/external.rs:181-187 | tools/benchmark-harness/src/adapters/external.rs:562-568 β€” 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 (7 lines × 3) integrations/python/surrealdb/examples/search_patterns.py:33 β€” integrations/python/surrealdb/examples/search_patterns.py:33-39 | integrations/python/surrealdb/examples/search_patterns.py:45-51 | integrations/python/surrealdb/examples/search_patterns.py:57-63 β€” 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 Β· Code Duplication Β· Duplicated block (5 lines × 3) Β· Γ—14
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/extractors/hierarchical.rs:111 β€” crates/xberg-native-pdf/src/extractors/hierarchical.rs:111-115 | crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:210-214 | crates/xberg-native-pdf/src/structure/converter.rs:107-111 β€” before extracting anything, compare `crates/xberg-native-pdf/src/extractors/synthetic_structure.rs` and `crates/xberg-native-pdf/src/structure/converter.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/extractors/images.rs:4328 β€” crates/xberg-native-pdf/src/extractors/images.rs:4328-4333 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3705-3713 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:4220-4224 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/extractors/paths.rs:477 β€” crates/xberg-native-pdf/src/extractors/paths.rs:477-481 | crates/xberg-native-pdf/src/extractors/paths.rs:490-494 | crates/xberg-native-pdf/src/extractors/paths.rs:502-506 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5019 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5019-5023 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6085-6089 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:7014-7018 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg/src/extractors/docbook.rs:921 β€” crates/xberg/src/extractors/docbook.rs:921-925 | crates/xberg/src/extractors/docbook.rs:929-933 | crates/xberg/src/extractors/docbook.rs:1225-1229 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg/src/extractors/iwork/keynote.rs:220 β€” crates/xberg/src/extractors/iwork/keynote.rs:220-224 | crates/xberg/src/extractors/iwork/numbers.rs:1351-1355 | crates/xberg/src/extractors/iwork/pages.rs:183-187 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 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 (5 lines × 3) crates/xberg/src/extractors/odp.rs:545 β€” crates/xberg/src/extractors/odp.rs:545-549 | crates/xberg/src/extractors/odt.rs:1754-1758 | crates/xberg/src/extractors/rtf/mod.rs:379-383 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 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 (5 lines × 3) crates/xberg/src/extractors/typst.rs:815 β€” crates/xberg/src/extractors/typst.rs:815-819 | crates/xberg/src/extractors/typst.rs:829-833 | crates/xberg/src/extractors/typst.rs:843-847 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg/src/text/classification/chunk_classifier.rs:115 β€” crates/xberg/src/text/classification/chunk_classifier.rs:115-119 | crates/xberg/src/text/classification/page_classifier.rs:99-103 | crates/xberg/src/text/classification/page_classifier.rs:107-111 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/extractors/forms.rs:500 β€” crates/xberg-native-pdf/src/extractors/forms.rs:500-504 | crates/xberg-native-pdf/src/extractors/forms.rs:699-703 | crates/xberg-native-pdf/src/extractors/forms.rs:705-709 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:98 β€” crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:98-102 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:260-264 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:884-888 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg/src/extractors/docbook.rs:1190 β€” crates/xberg/src/extractors/docbook.rs:1190-1194 | crates/xberg/src/extractors/docbook.rs:1210-1214 | crates/xberg/src/extractors/docbook.rs:1218-1222 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) crates/xberg-native-pdf/src/rendering/mod.rs:157 β€” crates/xberg-native-pdf/src/rendering/mod.rs:157-161 | crates/xberg/src/extractors/structured.rs:99-103 | crates/xberg/src/extractors/structured.rs:305-309 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs:173 β€” crates/xberg/src/extractors/djot_format/extractor.rs:173-177 | crates/xberg/src/extractors/djot_format/extractor.rs:203-207 | crates/xberg/src/extractors/djot_format/extractor.rs:233-237 β€” 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.
D2 Β· Cognitive Complexity Β· TextExtractor Β· Γ—13
  • TextExtractor::execute_operator (cognitive 186) crates/xberg-native-pdf/src/extractors/text/operators.rs:14 β€” TextExtractor::execute_operator has cognitive complexity 186 (threshold 15). Drivers by points: if/else 55 (156 pts), match/switch 6 (15 pts), boolean chains 8, loops 2 (7 pts) (nesting depth added 115). 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.
  • TextExtractor::append_advance_buffer (cognitive 149) crates/xberg-native-pdf/src/extractors/text/advance.rs:311 β€” TextExtractor::append_advance_buffer has cognitive complexity 149 (threshold 15). Drivers by points: if/else 32 (99 pts), loops 9 (43 pts), boolean chains 7 (nesting depth added 101). 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.
  • TextExtractor::append_and_advance (cognitive 135) crates/xberg-native-pdf/src/extractors/text/advance.rs:125 β€” TextExtractor::append_and_advance has cognitive complexity 135 (threshold 15). Drivers by points: if/else 26 (86 pts), loops 9 (41 pts), boolean chains 8 (nesting depth added 92). 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.
  • TextExtractor::merge_adjacent_spans (cognitive 127) crates/xberg-native-pdf/src/extractors/text/span_merging.rs:12 β€” TextExtractor::merge_adjacent_spans has cognitive complexity 127 (threshold 15). Drivers by points: if/else 38 (96 pts), boolean chains 26, match/switch 2 (4 pts), loops 1 (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.
  • TextExtractor::process_xobject (cognitive 119) crates/xberg-native-pdf/src/extractors/text/xobjects.rs:140 β€” TextExtractor::process_xobject has cognitive complexity 119 (threshold 15). Drivers by points: if/else 38 (92 pts), match/switch 7 (17 pts), boolean chains 10 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TextExtractor::show_text (cognitive 54) crates/xberg-native-pdf/src/extractors/text/advance.rs:845 β€” TextExtractor::show_text has cognitive complexity 54 (threshold 15). Drivers by points: if/else 28 (47 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextExtractor::advance_position_for_string (cognitive 35) crates/xberg-native-pdf/src/extractors/text/advance.rs:14 β€” TextExtractor::advance_position_for_string has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (11 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.
  • TextExtractor::placed_pdf_text_dominates (cognitive 26) crates/xberg-native-pdf/src/extractors/text/marked_content.rs:72 β€” TextExtractor::placed_pdf_text_dominates has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextExtractor::flush_tj_span_buffer (cognitive 22) crates/xberg-native-pdf/src/extractors/text/advance.rs:730 β€” TextExtractor::flush_tj_span_buffer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (7 pts), boolean chains 2 (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.
  • TextExtractor::sort_by_reading_order (cognitive 18) crates/xberg-native-pdf/src/extractors/text/span_merging.rs:647 β€” TextExtractor::sort_by_reading_order has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextExtractor::apply_ligature_decisions (cognitive 17) crates/xberg-native-pdf/src/extractors/text/clustering.rs:299 β€” TextExtractor::apply_ligature_decisions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (5 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.
  • TextExtractor::detect_span_columns (cognitive 16) crates/xberg-native-pdf/src/extractors/text/span_ordering.rs:256 β€” TextExtractor::detect_span_columns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 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.
  • TextExtractor::detect_rtl_draw_direction (cognitive 16) crates/xberg-native-pdf/src/extractors/text/span_ordering.rs:605 β€” TextExtractor::detect_rtl_draw_direction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2, boolean chains 1 (nesting depth added 7). 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.
D3 Β· God Classes Β· TooManyFields Β· Γ—13
  • TooManyFields: DynamicPdfiumBindings crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:35 β€” TooManyFields β€” 447 stored fields beside 3 methods. The bar is 30 stored fields; this is 417 over it, 14.90× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: ExtractionOverrides crates/xberg-cli/src/commands/overrides/mod.rs:54 β€” TooManyFields β€” 59 stored fields beside 37 methods. The bar is 30 stored fields; this is 29 over it, 1.97× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: ExtractionConfig crates/xberg/src/core/config/extraction/core.rs:38 β€” TooManyFields β€” 58 stored fields beside 41 methods. The bar is 30 stored fields; this is 28 over it, 1.93× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: PdfDocument crates/xberg-native-pdf/src/document/mod.rs:558 β€” TooManyFields β€” 52 stored fields beside 364 methods. The bar is 30 stored fields; this is 22 over it, 1.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: TextExtractor crates/xberg-native-pdf/src/extractors/text/mod.rs:2137 β€” TooManyFields β€” 38 stored fields beside 101 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: FontInfo crates/xberg-native-pdf/src/fonts/font_dict.rs:47 β€” TooManyFields β€” 38 stored fields beside 54 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: GraphicsState crates/xberg-native-pdf/src/content/graphics_state.rs:210 β€” TooManyFields β€” 37 stored fields beside 4 methods. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: ExtractedDocument crates/xberg/src/types/extraction.rs:137 β€” TooManyFields β€” 37 stored fields beside 1 method. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: FileExtractionConfig crates/xberg/src/core/config/extraction/file_config.rs:48 β€” TooManyFields β€” 36 stored fields. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: PerFixtureRow tools/benchmark-harness/src/aggregate/types.rs:72 β€” TooManyFields β€” 35 stored fields. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: DeepseekV2Config crates/xberg-candle-ocr/src/models/deepseek_ocr/config.rs:11 β€” TooManyFields β€” 33 stored fields. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: PdfRenderConfig crates/xberg-pdfium-render/src/pdf/document/page/render_config.rs:67 β€” TooManyFields β€” 31 stored fields beside 45 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
  • TooManyFields: PaddleOCRVLConfig crates/xberg-candle-ocr/src/models/paddleocr_vl/config.rs:10 β€” TooManyFields β€” 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member β€” each reader then names only the group it uses.
D4 Β· Code Duplication Β· Duplicated block (18 lines × 2) Β· Γ—12
  • Duplicated block (18 lines × 2) crates/xberg-cli/src/main.rs:1047 β€” crates/xberg-cli/src/main.rs:1047-1064 | crates/xberg-cli/src/main.rs:1067-1084 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/content/parser.rs:1813 β€” crates/xberg-native-pdf/src/content/parser.rs:1813-1830 | crates/xberg-native-pdf/src/content/parser.rs:2021-2038 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/pipeline/config.rs:90 β€” crates/xberg-native-pdf/src/pipeline/config.rs:90-107 | crates/xberg-native-pdf/src/pipeline/config.rs:118-135 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1979 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1979-1996 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2026-2043 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (18 lines × 2) crates/xberg/src/extraction/docx/table/mod.rs:298 β€” crates/xberg/src/extraction/docx/table/mod.rs:298-315 | crates/xberg/src/extraction/docx/table/mod.rs:317-334 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/table/mod.rs:723 β€” crates/xberg/src/extraction/docx/table/mod.rs:723-740 | crates/xberg/src/extraction/docx/table/mod.rs:742-759 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/excel/package_metadata.rs:163 β€” crates/xberg/src/extraction/excel/package_metadata.rs:163-180 | crates/xberg/src/extraction/pptx/metadata.rs:100-117 β€” before extracting anything, compare `crates/xberg/src/extraction/excel/package_metadata.rs` and `crates/xberg/src/extraction/pptx/metadata.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 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 (18 lines × 2) crates/xberg/src/extractors/docbook.rs:1130 β€” crates/xberg/src/extractors/docbook.rs:1130-1147 | crates/xberg/src/extractors/jats/mod.rs:63-80 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 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 (18 lines × 2) crates/xberg/src/extractors/jats/elements.rs:227 β€” crates/xberg/src/extractors/jats/elements.rs:227-244 | crates/xberg/src/extractors/jats/mod.rs:420-437 β€” before extracting anything, compare `crates/xberg/src/extractors/jats/elements.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) crates/xberg/src/mcp/resources.rs:95 β€” crates/xberg/src/mcp/resources.rs:95-112 | crates/xberg/src/mcp/server.rs:408-425 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (18 lines × 2) tools/benchmark-harness/src/comparison/execution.rs:220 β€” tools/benchmark-harness/src/comparison/execution.rs:220-237 | tools/benchmark-harness/src/pipeline_benchmark/mod.rs:184-201 β€” 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 (18 lines × 2) tools/benchmark-harness/scripts/build_language_sidecar.py:58 β€” tools/benchmark-harness/scripts/build_language_sidecar.py:58-81 | tools/benchmark-harness/scripts/plausibility_calibrate.py:83-100 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D2 Β· Cognitive Complexity Β· FontInfo Β· Γ—11
  • FontInfo::char_to_unicode_uncached (cognitive 191) crates/xberg-native-pdf/src/fonts/font_dict.rs:4319 β€” FontInfo::char_to_unicode_uncached has cognitive complexity 191 (threshold 15). Drivers by points: if/else 62 (154 pts), boolean chains 33, match/switch 3 (4 pts) (nesting depth added 93). 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.
  • FontInfo::from_dict (cognitive 73) crates/xberg-native-pdf/src/fonts/font_dict.rs:737 β€” FontInfo::from_dict has cognitive complexity 73 (threshold 15). Drivers by points: if/else 41 (54 pts), match/switch 5 (11 pts), boolean chains 8 (nesting depth added 19). 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.
  • FontInfo::resolve_encoding_fields (cognitive 62) crates/xberg-native-pdf/src/fonts/font_dict.rs:1540 β€” FontInfo::resolve_encoding_fields has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (47 pts), loops 3 (10 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 35). Of this number, 59 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.
  • FontInfo::apply_differences_array (cognitive 31) crates/xberg-native-pdf/src/fonts/font_dict.rs:2888 β€” FontInfo::apply_differences_array has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (28 pts), match/switch 1 (2 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.
  • FontInfo::parse_descendant_fonts (cognitive 29) crates/xberg-native-pdf/src/fonts/font_dict.rs:1791 β€” FontInfo::parse_descendant_fonts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (21 pts), match/switch 5 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • FontInfo::parse_cid_vertical_metrics (cognitive 28) crates/xberg-native-pdf/src/fonts/font_dict.rs:2556 β€” FontInfo::parse_cid_vertical_metrics has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FontInfo::extract_embedded_font_from_descriptor (cognitive 27) crates/xberg-native-pdf/src/fonts/font_dict.rs:2200 β€” FontInfo::extract_embedded_font_from_descriptor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4 (11 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.
  • FontInfo::resolve_base_encoding_map (cognitive 25) crates/xberg-native-pdf/src/fonts/font_dict.rs:2823 β€” FontInfo::resolve_base_encoding_map has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FontInfo::compute_font_weight (cognitive 22) crates/xberg-native-pdf/src/fonts/font_dict.rs:5071 β€” FontInfo::compute_font_weight has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4 (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.
  • FontInfo::std14_width (cognitive 21) crates/xberg-native-pdf/src/fonts/font_dict.rs:3358 β€” FontInfo::std14_width has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 6 (10 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • FontInfo::parse_cid_widths (cognitive 19) crates/xberg-native-pdf/src/fonts/font_dict.rs:2665 β€” FontInfo::parse_cid_widths has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 3 (7 pts), loops 2 (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.
D4 Β· Code Duplication Β· Duplicated block (17 lines × 2) Β· Γ—11
  • Duplicated block (17 lines × 2) crates/xberg-native-pdf/src/document/tables.rs:107 β€” crates/xberg-native-pdf/src/document/tables.rs:107-123 | crates/xberg-native-pdf/src/document/tables.rs:219-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.
  • Duplicated block (17 lines × 2) crates/xberg-native-pdf/src/extractors/images.rs:2658 β€” crates/xberg-native-pdf/src/extractors/images.rs:2658-2674 | crates/xberg-native-pdf/src/extractors/images.rs:2700-2716 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/xberg-native-pdf/src/fonts/font_dict.rs:6147 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:6147-6163 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6288-6304 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1636 β€” crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1636-1652 | crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1810-1826 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/xberg/src/extraction/archive/tar.rs:110 β€” crates/xberg/src/extraction/archive/tar.rs:110-126 | crates/xberg/src/extraction/archive/tar.rs:197-213 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/xberg/src/extraction/pptx/container.rs:52 β€” crates/xberg/src/extraction/pptx/container.rs:52-68 | crates/xberg/src/extraction/pptx/container.rs:80-96 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:265 β€” crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:265-281 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:542-558 β€” before extracting anything, compare `crates/xberg/src/extractors/rtf/parser/formatting_extract.rs` and `crates/xberg/src/extractors/rtf/parser/text_extract.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 (17 lines × 2) tools/benchmark-harness/src/adapters/subprocess.rs:90 β€” tools/benchmark-harness/src/adapters/subprocess.rs:90-106 | tools/benchmark-harness/src/adapters/subprocess.rs:132-148 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) tools/benchmark-harness/src/adapters/subprocess/batch_exec.rs:435 β€” tools/benchmark-harness/src/adapters/subprocess/batch_exec.rs:435-451 | tools/benchmark-harness/src/runner/execution.rs:358-374 β€” 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 (17 lines × 2) tools/benchmark-harness/scripts/docling_extract.py:325 β€” tools/benchmark-harness/scripts/docling_extract.py:325-341 | tools/benchmark-harness/scripts/mineru_extract.py:327-343 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/mineru_extract.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 130 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 (17 lines × 2) tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:70 β€” tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:70-86 | tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:104-120 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand β€” widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 Β· Code Duplication Β· Duplicated block (13–14 lines × 2) Β· Γ—11
  • Duplicated block (13–14 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:600 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:600-613 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:770-782 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (13–14 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7715 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7715-7727 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:7786-7799 β€” both copies are in the same file, so extract the 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–14 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7861 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7861-7874 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:8033-8045 β€” both copies are in the same file, so extract the 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–14 lines × 2) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:792 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:792-804 | crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:822-835 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (13–14 lines × 2) crates/xberg-native-pdf/src/xref_reconstruction.rs:466 β€” crates/xberg-native-pdf/src/xref_reconstruction.rs:466-479 | crates/xberg-native-pdf/src/xref_reconstruction.rs:652-664 β€” both copies are in the same file, so extract the 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–14 lines × 2) crates/xberg/src/extraction/email/rtf.rs:236 β€” crates/xberg/src/extraction/email/rtf.rs:236-248 | crates/xberg/src/rendering/markdown.rs:78-91 β€” 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 (13–14 lines × 2) crates/xberg/src/extractors/epub/mod.rs:630 β€” crates/xberg/src/extractors/epub/mod.rs:630-643 | crates/xberg/src/extractors/html.rs:245-257 β€” 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 (13–14 lines × 2) crates/xberg/src/extractors/pdf/mod.rs:2522 β€” crates/xberg/src/extractors/pdf/mod.rs:2522-2534 | crates/xberg/src/extractors/pdf/mod.rs:2880-2893 β€” both copies are in the same file, so extract the 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–14 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1375 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1375-1388 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1539-1551 β€” both copies are in the same file, so extract the 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–14 lines × 2) crates/xberg/src/rendering/common.rs:728 β€” crates/xberg/src/rendering/common.rs:728-740 | crates/xberg/src/utils/mod.rs:190-203 β€” 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 (13–14 lines × 2) crates/xberg/src/reranking/engine.rs:233 β€” crates/xberg/src/reranking/engine.rs:233-246 | crates/xberg/src/sparse_embeddings/engine.rs:96-108 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (6 lines × 3) Β· Γ—11
  • Duplicated block (6 lines × 3) crates/xberg/src/core/image_encode.rs:289 β€” crates/xberg/src/core/image_encode.rs:289-294 | crates/xberg/src/core/image_encode.rs:329-334 | crates/xberg/src/extraction/diagram/svg/mod.rs:54-59 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) crates/xberg/src/extraction/docx/math/elements.rs:45 β€” crates/xberg/src/extraction/docx/math/elements.rs:45-50 | crates/xberg/src/extraction/docx/math/elements.rs:398-403 | crates/xberg/src/extraction/docx/math/elements.rs:580-585 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg/src/extractors/docbook.rs:340 β€” crates/xberg/src/extractors/docbook.rs:340-345 | crates/xberg/src/extractors/jats/mod.rs:316-321 | crates/xberg/src/extractors/typst.rs:477-482 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) crates/xberg/src/extractors/docbook.rs:1003 β€” crates/xberg/src/extractors/docbook.rs:1003-1008 | crates/xberg/src/extractors/docbook.rs:1311-1316 | crates/xberg/src/extractors/docbook.rs:1371-1376 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg/src/extractors/fictionbook.rs:619 β€” crates/xberg/src/extractors/fictionbook.rs:619-624 | crates/xberg/src/extractors/fictionbook.rs:1007-1012 | crates/xberg/src/extractors/fictionbook.rs:1068-1073 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg/src/extractors/jats/mod.rs:116 β€” crates/xberg/src/extractors/jats/mod.rs:116-121 | crates/xberg/src/extractors/jats/parser.rs:363-368 | crates/xberg/src/extractors/jats/parser.rs:384-389 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) crates/xberg/src/ocr/hocr_parser.rs:200 β€” crates/xberg/src/ocr/hocr_parser.rs:200-205 | crates/xberg/src/ocr/hocr_parser.rs:695-700 | crates/xberg/src/ocr/hocr_parser.rs:1104-1109 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg/src/plugins/registry/ocr.rs:371 β€” crates/xberg/src/plugins/registry/ocr.rs:371-376 | crates/xberg/src/plugins/registry/reranker.rs:95-100 | crates/xberg/src/plugins/registry/tokenizer.rs:117-122 β€” 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 × 3) crates/xberg/src/extraction/pptx/container.rs:53 β€” crates/xberg/src/extraction/pptx/container.rs:53-61 | crates/xberg/src/extraction/pptx/container.rs:81-89 | crates/xberg/src/extraction/pptx/container.rs:181-186 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg/src/extractors/docx.rs:1042 β€” crates/xberg/src/extractors/docx.rs:1042-1048 | crates/xberg/src/extractors/docx.rs:1051-1056 | crates/xberg/src/extractors/docx.rs:1091-1096 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7992 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7992-7997 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:726-731 | crates/xberg-native-pdf/src/rendering/resolution/pipeline.rs:256-261 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
D6 Β· Cohesion (LCOM4) Β· Low cohesion Β· Γ—11
  • Low cohesion: DynamicPdfiumBindings (LCOM4 446) crates/xberg-pdfium-render/src/bindings/dynamic_bindings.rs:35 β€” DynamicPdfiumBindings's methods fall into 446 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 446 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: OcrBackendDartCallbacks (LCOM4 13) packages/dart/rust/src/lib.rs:23337 β€” OcrBackendDartCallbacks's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PaddleOcrConfig (LCOM4 12) crates/xberg/src/paddle_ocr/config.rs:40 β€” PaddleOcrConfig's methods fall into 12 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 12 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: XbergMcp (LCOM4 9) crates/xberg/src/mcp/server.rs:89 β€” XbergMcp's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LibHeif (LCOM4 8) crates/xberg-libheif/src/heif.rs:24 β€” LibHeif's methods fall into 8 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 8 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: PostProcessorDartCallbacks (LCOM4 5) packages/dart/rust/src/lib.rs:23900 β€” PostProcessorDartCallbacks's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: InternalDocument (LCOM4 4) crates/xberg/src/types/internal.rs:195 β€” InternalDocument's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Parameters (LCOM4 4) crates/xberg-gliner/src/config.rs:33 β€” Parameters's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ImageContent (LCOM4 4) crates/xberg-native-pdf/src/elements/image.rs:12 β€” ImageContent's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: PathContent (LCOM4 4) crates/xberg-native-pdf/src/elements/path.rs:14 β€” PathContent's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DocumentExtractorDartCallbacks (LCOM4 4) packages/dart/rust/src/lib.rs:24379 β€” DocumentExtractorDartCallbacks's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable β€” your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected β€” and which would otherwise dominate this list β€” are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D1 Β· Cyclomatic Complexity Β· PageRenderer Β· Γ—10
  • PageRenderer::execute_operators (cyclomatic 167) crates/xberg-native-pdf/src/rendering/page_renderer.rs:966 β€” PageRenderer::execute_operators has cyclomatic complexity 167 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PageRenderer::render_image (cyclomatic 51) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3629 β€” PageRenderer::render_image has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PageRenderer::fill_with_tiling_pattern (cyclomatic 38) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4505 β€” PageRenderer::fill_with_tiling_pattern has cyclomatic complexity 38 (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.
  • PageRenderer::execute_knockout_group (cyclomatic 19) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6915 β€” PageRenderer::execute_knockout_group has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PageRenderer::mirror_cmyk_paint_into_sidecar (cyclomatic 18) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4957 β€” PageRenderer::mirror_cmyk_paint_into_sidecar has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PageRenderer::apply_overprint_after_paint (cyclomatic 18) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6462 β€” PageRenderer::apply_overprint_after_paint has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PageRenderer::apply_smask_after_paint_inner (cyclomatic 18) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6674 β€” PageRenderer::apply_smask_after_paint_inner has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • PageRenderer::render_xobject (cyclomatic 17) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3507 β€” PageRenderer::render_xobject 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.
  • PageRenderer::render_page_with_options (cyclomatic 16) crates/xberg-native-pdf/src/rendering/page_renderer.rs:565 β€” PageRenderer::render_page_with_options 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.
  • PageRenderer::render_image_mask (cyclomatic 16) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4198 β€” PageRenderer::render_image_mask 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 Β· Duplicated block (8 lines × 3) Β· Γ—10
  • Duplicated block (8 lines × 3) crates/xberg-native-pdf/src/document/mod.rs:1120 β€” crates/xberg-native-pdf/src/document/mod.rs:1120-1127 | crates/xberg-native-pdf/src/rendering/sidecar.rs:988-995 | crates/xberg-native-pdf/src/rendering/sidecar.rs:1578-1585 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 3) crates/xberg-pdfium-render/src/pdf/document/fonts.rs:357 β€” crates/xberg-pdfium-render/src/pdf/document/fonts.rs:357-364 | crates/xberg-pdfium-render/src/pdf/document/fonts.rs:492-499 | crates/xberg-pdfium-render/src/pdfium.rs:428-435 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 3) crates/xberg/src/extraction/docx/parser.rs:1248 β€” crates/xberg/src/extraction/docx/parser.rs:1248-1255 | crates/xberg/src/extractors/csv.rs:521-528 | crates/xberg/src/pdf/structure/regions/table_recognition.rs:1080-1087 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) crates/xberg/src/extraction/docx/table/mod.rs:584 β€” crates/xberg/src/extraction/docx/table/mod.rs:584-591 | crates/xberg/src/extraction/docx/table/mod.rs:657-664 | crates/xberg/src/extraction/docx/table/mod.rs:718-725 β€” 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 (8 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs:164 β€” crates/xberg/src/extractors/djot_format/extractor.rs:164-171 | crates/xberg/src/extractors/djot_format/extractor.rs:194-201 | crates/xberg/src/extractors/djot_format/extractor.rs:224-231 β€” 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 (8 lines × 3) crates/xberg/src/extractors/latex/mod.rs:1202 β€” crates/xberg/src/extractors/latex/mod.rs:1202-1209 | crates/xberg/src/extractors/orgmode.rs:636-643 | crates/xberg/src/extractors/rst.rs:1646-1653 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) crates/xberg/src/extractors/rst.rs:564 β€” crates/xberg/src/extractors/rst.rs:564-571 | crates/xberg/src/extractors/rst.rs:583-590 | crates/xberg/src/extractors/rst.rs:602-609 β€” 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 (8 lines × 3) crates/xberg-native-pdf/src/content/parser.rs:3605 β€” crates/xberg-native-pdf/src/content/parser.rs:3605-3612 | crates/xberg-native-pdf/src/decoders/ascii_hex.rs:46-53 | crates/xberg/src/extractors/rtf/encoding.rs:11-18 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) crates/xberg/src/extractors/pdf/ocr/document.rs:312 β€” crates/xberg/src/extractors/pdf/ocr/document.rs:312-319 | crates/xberg/src/extractors/pdf/ocr/document.rs:1540-1547 | crates/xberg/src/paddle_ocr/backend.rs:1186-1193 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 3) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:842 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:842-849 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:857-864 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:885-892 β€” 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.
D1 Β· Cyclomatic Complexity Β· TextExtractor Β· Γ—9
  • TextExtractor::execute_operator (cyclomatic 103) crates/xberg-native-pdf/src/extractors/text/operators.rs:14 β€” TextExtractor::execute_operator has cyclomatic complexity 103 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextExtractor::merge_adjacent_spans (cyclomatic 58) crates/xberg-native-pdf/src/extractors/text/span_merging.rs:12 β€” TextExtractor::merge_adjacent_spans has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextExtractor::process_xobject (cyclomatic 51) crates/xberg-native-pdf/src/extractors/text/xobjects.rs:140 β€” TextExtractor::process_xobject has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • TextExtractor::append_advance_buffer (cyclomatic 40) crates/xberg-native-pdf/src/extractors/text/advance.rs:311 β€” TextExtractor::append_advance_buffer 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.
  • TextExtractor::append_and_advance (cyclomatic 38) crates/xberg-native-pdf/src/extractors/text/advance.rs:125 β€” TextExtractor::append_and_advance 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.
  • TextExtractor::show_text (cyclomatic 23) crates/xberg-native-pdf/src/extractors/text/advance.rs:845 β€” TextExtractor::show_text 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.
  • TextExtractor::placed_pdf_text_dominates (cyclomatic 16) crates/xberg-native-pdf/src/extractors/text/marked_content.rs:72 β€” TextExtractor::placed_pdf_text_dominates 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.
  • TextExtractor::apply_set_fill_color_n (cyclomatic 16) crates/xberg-native-pdf/src/extractors/text/operators.rs:1055 β€” TextExtractor::apply_set_fill_color_n has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (TextExtractor::apply_set_stroke_color_n) 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.
  • TextExtractor::apply_set_stroke_color_n (cyclomatic 16) crates/xberg-native-pdf/src/extractors/text/operators.rs:1131 β€” TextExtractor::apply_set_stroke_color_n has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This shape REPEATS in the file: one other method here (TextExtractor::apply_set_fill_color_n) has the same decision points, in the same order, at the same nesting depths β€” so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 Β· Code Duplication Β· Duplicated block (20 lines × 2) Β· Γ—9
  • Duplicated block (20 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:1318 β€” crates/xberg-native-pdf/src/document/extract_api.rs:1318-1337 | crates/xberg-native-pdf/src/document/extract_api.rs:1674-1693 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/xberg-native-pdf/src/xfa/extractor.rs:75 β€” crates/xberg-native-pdf/src/xfa/extractor.rs:75-94 | crates/xberg-native-pdf/src/xfa/extractor.rs:105-124 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/text/char.rs:343 β€” crates/xberg-pdfium-render/src/pdf/document/page/text/char.rs:343-362 | crates/xberg-pdfium-render/src/pdf/document/page/text/char.rs:376-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.
  • Duplicated block (20 lines × 2) crates/xberg/src/candle_ocr/ocr_result.rs:173 β€” crates/xberg/src/candle_ocr/ocr_result.rs:173-192 | crates/xberg/src/llm/vlm_ocr.rs:288-307 β€” before extracting anything, compare `crates/xberg/src/candle_ocr/ocr_result.rs` and `crates/xberg/src/llm/vlm_ocr.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 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 (20 lines × 2) crates/xberg/src/extraction/ppt/mod.rs:870 β€” crates/xberg/src/extraction/ppt/mod.rs:870-889 | crates/xberg/src/extraction/ppt/mod.rs:894-913 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:392 β€” crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:392-411 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:798-817 β€” before extracting anything, compare `crates/xberg/src/extractors/rtf/parser/formatting_extract.rs` and `crates/xberg/src/extractors/rtf/parser/text_extract.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 (20 lines × 2) crates/xberg/src/extractors/rtf/parser/text_extract.rs:400 β€” crates/xberg/src/extractors/rtf/parser/text_extract.rs:400-419 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:585-604 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/xberg/src/mcp/server.rs:1200 β€” crates/xberg/src/mcp/server.rs:1200-1219 | crates/xberg/src/mcp/server.rs:1262-1281 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) crates/xberg/src/plugins/processor/builtin/ner.rs:85 β€” crates/xberg/src/plugins/processor/builtin/ner.rs:85-104 | crates/xberg/src/text/redaction/engine.rs:1261-1280 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (19 lines × 2) Β· Γ—9
  • Duplicated block (19 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1570 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1570-1588 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1793-1811 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2134 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2134-2152 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2163-2181 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg/src/extraction/docx/table/mod.rs:594 β€” crates/xberg/src/extraction/docx/table/mod.rs:594-612 | crates/xberg/src/extraction/docx/table/mod.rs:619-637 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg/src/extractors/docbook.rs:1255 β€” crates/xberg/src/extractors/docbook.rs:1255-1273 | crates/xberg/src/extractors/jats/mod.rs:159-177 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 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 (19 lines × 2) crates/xberg/src/extractors/latex/utilities.rs:13 β€” crates/xberg/src/extractors/latex/utilities.rs:13-31 | crates/xberg/src/extractors/latex/utilities.rs:505-523 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2960 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2960-2978 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3089-3107 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg/src/pdf/native/table.rs:152 β€” crates/xberg/src/pdf/native/table.rs:152-170 | crates/xberg/src/pdf/native/table.rs:273-291 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) crates/xberg/src/pdf/structure/adapters.rs:1575 β€” crates/xberg/src/pdf/structure/adapters.rs:1575-1593 | crates/xberg/src/pdf/structure/pipeline.rs:1260-1278 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/adapters.rs` and `crates/xberg/src/pdf/structure/pipeline.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) tools/benchmark-harness/src/sizes.rs:165 β€” tools/benchmark-harness/src/sizes.rs:165-183 | tools/benchmark-harness/src/sizes.rs:217-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.
D2 Β· Cognitive Complexity Β· FictionBookExtractor Β· Γ—8
  • FictionBookExtractor::extract_metadata (cognitive 149) crates/xberg/src/extractors/fictionbook.rs:133 β€” FictionBookExtractor::extract_metadata has cognitive complexity 149 (threshold 15). Drivers by points: if/else 40 (127 pts), loops 4 (12 pts), match/switch 3 (8 pts), boolean chains 2 (nesting depth added 100). 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.
  • FictionBookExtractor::build_internal_document (cognitive 113) crates/xberg/src/extractors/fictionbook.rs:669 β€” FictionBookExtractor::build_internal_document has cognitive complexity 113 (threshold 15). Drivers by points: if/else 26 (59 pts), match/switch 7 (26 pts), boolean chains 17, loops 5 (11 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FictionBookExtractor::extract_paragraph_with_annotations (cognitive 70) crates/xberg/src/extractors/fictionbook.rs:860 β€” FictionBookExtractor::extract_paragraph_with_annotations has cognitive complexity 70 (threshold 15). Drivers by points: if/else 11 (41 pts), match/switch 4 (13 pts), loops 4 (11 pts), boolean chains 5 (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.
  • FictionBookExtractor::extract_links (cognitive 58) crates/xberg/src/extractors/fictionbook.rs:574 β€” FictionBookExtractor::extract_links has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (40 pts), loops 3 (9 pts), match/switch 2 (7 pts), boolean chains 2 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FictionBookExtractor::extract_binary_images (cognitive 45) crates/xberg/src/extractors/fictionbook.rs:459 β€” FictionBookExtractor::extract_binary_images has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (9 pts), match/switch 2 (7 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.
  • FictionBookExtractor::extract_text_content (cognitive 34) crates/xberg/src/extractors/fictionbook.rs:52 β€” FictionBookExtractor::extract_text_content has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (24 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • FictionBookExtractor::extract_footnote_text (cognitive 28) crates/xberg/src/extractors/fictionbook.rs:1032 β€” FictionBookExtractor::extract_footnote_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (24 pts), match/switch 1 (2 pts), boolean chains 1, 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.
  • FictionBookExtractor::extract_table (cognitive 17) crates/xberg/src/extractors/fictionbook.rs:391 β€” FictionBookExtractor::extract_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (8 pts), match/switch 3 (8 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.
D2 Β· Cognitive Complexity Β· XYCutStrategy Β· Γ—8
  • XYCutStrategy::short_line_central_corridor_prose (cognitive 49) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1082 β€” XYCutStrategy::short_line_central_corridor_prose has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (33 pts), loops 9 (13 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • XYCutStrategy::is_single_column_region (cognitive 36) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1691 β€” XYCutStrategy::is_single_column_region has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 7 (10 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.
  • XYCutStrategy::find_heading_runs (cognitive 32) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:463 β€” XYCutStrategy::find_heading_runs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • XYCutStrategy::detect_narrow_gutter_prose (cognitive 32) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1432 β€” XYCutStrategy::detect_narrow_gutter_prose has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 8 (11 pts), boolean chains 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.
  • XYCutStrategy::detect_two_column_prose (cognitive 29) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1250 β€” XYCutStrategy::detect_two_column_prose has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 5 (6 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.
  • XYCutStrategy::partition_indexed_depth (cognitive 25) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:760 β€” XYCutStrategy::partition_indexed_depth has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • XYCutStrategy::peel_full_width_line_bands (cognitive 21) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1583 β€” XYCutStrategy::peel_full_width_line_bands has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • XYCutStrategy::find_horizontal_split_indexed (cognitive 19) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1887 β€” XYCutStrategy::find_horizontal_split_indexed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 Β· Code Duplication Β· Duplicated block (10–11 lines × 2) Β· Γ—8
  • Duplicated block (10–11 lines × 2) crates/xberg-native-pdf/src/decoders/ccitt.rs:112 β€” crates/xberg-native-pdf/src/decoders/ccitt.rs:112-122 | crates/xberg-native-pdf/src/decoders/ccitt.rs:196-205 β€” both copies are in the same file, so extract the 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–11 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2111 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2111-2121 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2128-2137 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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–11 lines × 2) crates/xberg-native-pdf/src/xfa/parser.rs:509 β€” crates/xberg-native-pdf/src/xfa/parser.rs:509-519 | crates/xberg-native-pdf/src/xfa/parser.rs:524-533 β€” both copies are in the same file, so extract the 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–11 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/paragraph.rs:548 β€” crates/xberg-pdfium-render/src/pdf/document/page/paragraph.rs:548-557 | crates/xberg-pdfium-render/src/pdf/document/page/paragraph.rs:559-569 β€” both copies are in the same file, so extract the 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–11 lines × 2) crates/xberg/src/extraction/docx/parser.rs:3499 β€” crates/xberg/src/extraction/docx/parser.rs:3499-3509 | crates/xberg/src/extraction/docx/parser.rs:3519-3528 β€” both copies are in the same file, so extract the 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–11 lines × 2) crates/xberg/src/extractors/docx.rs:725 β€” crates/xberg/src/extractors/docx.rs:725-734 | crates/xberg/src/extractors/wordperfect.rs:668-678 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (10–11 lines × 2) crates/xberg/src/extractors/jats/elements.rs:19 β€” crates/xberg/src/extractors/jats/elements.rs:19-28 | crates/xberg/src/extractors/jats/elements.rs:35-45 β€” both copies are in the same file, so extract the 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–11 lines × 2) tools/benchmark-harness/src/sizes/package_measurements.rs:338 β€” tools/benchmark-harness/src/sizes/package_measurements.rs:338-347 | tools/benchmark-harness/src/sizes/package_measurements.rs:355-365 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D5 Β· Coupling Β· Off the main sequence Β· Γ—8
  • Off the main sequence: xberg-candle-ocr β€” xberg-candle-ocr: 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: xberg-libwpd β€” xberg-libwpd: 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: xberg-tesseract β€” xberg-tesseract: 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: xberg-native-pdf β€” xberg-native-pdf: abstractness 0.04, instability 0.00, distance 0.96 β€” zone of pain β€” concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: xberg-libheif β€” xberg-libheif: abstractness 0.05, instability 0.00, distance 0.95 β€” zone of pain β€” concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: xberg-gliner β€” xberg-gliner: abstractness 0.07, instability 0.00, distance 0.93 β€” zone of pain β€” concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: xberg-paddle-ocr β€” xberg-paddle-ocr: abstractness 0.07, instability 0.00, distance 0.93 β€” zone of pain β€” concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: xberg-pdfium-render β€” xberg-pdfium-render: abstractness 0.08, instability 0.00, distance 0.92 β€” zone of pain β€” concrete and depended on by 1 project(s), so it's rigid to change.
R4 Β· Test Coverage Β· No test reaches this file Β· Γ—8
  • No test reaches this file integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.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 integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.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 integrations/node/langchain-xberg/src/loader.ts:1 β€” No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL β€” if neither does, no test reaches this one.
  • No test reaches this file scripts/ci/smoke_test_node_binding.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 scripts/publish/node/smoke-glibc-2-28.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 integrations/node/llamaindex-xberg/src/reader.ts:1 β€” No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL β€” if neither does, no test reaches this one.
  • No test reaches this file scripts/task/patch-demo-dev.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 integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.constants.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.
D1 Β· Cyclomatic Complexity Β· FictionBookExtractor Β· Γ—7
  • FictionBookExtractor::extract_metadata (cyclomatic 67) crates/xberg/src/extractors/fictionbook.rs:133 β€” FictionBookExtractor::extract_metadata has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FictionBookExtractor::build_internal_document (cyclomatic 54) crates/xberg/src/extractors/fictionbook.rs:669 β€” FictionBookExtractor::build_internal_document has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FictionBookExtractor::extract_paragraph_with_annotations (cyclomatic 32) crates/xberg/src/extractors/fictionbook.rs:860 β€” FictionBookExtractor::extract_paragraph_with_annotations has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • FictionBookExtractor::extract_links (cyclomatic 24) crates/xberg/src/extractors/fictionbook.rs:574 β€” FictionBookExtractor::extract_links 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.
  • FictionBookExtractor::extract_text_content (cyclomatic 21) crates/xberg/src/extractors/fictionbook.rs:52 β€” FictionBookExtractor::extract_text_content 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.
  • FictionBookExtractor::extract_binary_images (cyclomatic 19) crates/xberg/src/extractors/fictionbook.rs:459 β€” FictionBookExtractor::extract_binary_images 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.
  • FictionBookExtractor::extract_footnote_text (cyclomatic 16) crates/xberg/src/extractors/fictionbook.rs:1032 β€” FictionBookExtractor::extract_footnote_text has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· XYCutStrategy Β· Γ—7
  • XYCutStrategy::short_line_central_corridor_prose (cyclomatic 31) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1082 β€” XYCutStrategy::short_line_central_corridor_prose has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • XYCutStrategy::detect_narrow_gutter_prose (cyclomatic 25) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1432 β€” XYCutStrategy::detect_narrow_gutter_prose 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.
  • XYCutStrategy::find_heading_runs (cyclomatic 22) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:463 β€” XYCutStrategy::find_heading_runs 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.
  • XYCutStrategy::is_single_column_region (cyclomatic 22) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1691 β€” XYCutStrategy::is_single_column_region 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.
  • XYCutStrategy::detect_two_column_prose (cyclomatic 21) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1250 β€” XYCutStrategy::detect_two_column_prose 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.
  • XYCutStrategy::partition_indexed_depth (cyclomatic 19) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:760 β€” XYCutStrategy::partition_indexed_depth has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • XYCutStrategy::find_horizontal_split_indexed (cyclomatic 16) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1887 β€” XYCutStrategy::find_horizontal_split_indexed has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· RstExtractor Β· Γ—7
  • RstExtractor::build_internal_document_within (cognitive 417) crates/xberg/src/extractors/rst.rs:986 β€” RstExtractor::build_internal_document_within has cognitive complexity 417 (threshold 15). Drivers by points: if/else 103 (272 pts), loops 27 (81 pts), boolean chains 64 (nesting depth added 223). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RstExtractor::extract_text_from_rst (cognitive 131) crates/xberg/src/extractors/rst.rs:236 β€” RstExtractor::extract_text_from_rst has cognitive complexity 131 (threshold 15). Drivers by points: if/else 28 (84 pts), loops 8 (24 pts), boolean chains 23 (nesting depth added 72). 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.
  • RstExtractor::parse_inline_markup (cognitive 82) crates/xberg/src/extractors/rst.rs:551 β€” RstExtractor::parse_inline_markup has cognitive complexity 82 (threshold 15). Drivers by points: if/else 23 (65 pts), boolean chains 16, loops 1 (nesting depth added 42). 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.
  • RstExtractor::is_list_item (cognitive 23) crates/xberg/src/extractors/rst.rs:485 β€” RstExtractor::is_list_item has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 9 (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.
  • RstExtractor::parse_list_table_rows (cognitive 17) crates/xberg/src/extractors/rst.rs:893 β€” RstExtractor::parse_list_table_rows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RstExtractor::extract_rst_cross_refs (cognitive 16) crates/xberg/src/extractors/rst.rs:1600 β€” RstExtractor::extract_rst_cross_refs 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.
  • RstExtractor::parse_simple_table_cells (cognitive 16) crates/xberg/src/extractors/rst.rs:1674 β€” RstExtractor::parse_simple_table_cells has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 3 (5 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.
D35 Β· Change Coupling Β· Change coupling Β· Γ—7
  • Change coupling: output.rs ↔ runner.rs tools/benchmark-harness/src/output.rs:1 β€” `tools/benchmark-harness/src/output.rs` and `tools/benchmark-harness/src/runner.rs` change together 68% of the time (13 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 13 shared commits counted here, the most recent 3 are `e5919905` fix(bench): publish failed cells, segment rankings, and fix quality s…; `5830dedd` fix(bench): enforce numeric quality artifact contract; `a4e6b203` fix(bench): enforce complete benchmark runs β€” run `git show` on any of them.
  • Change coupling: subprocess.rs ↔ output.rs tools/benchmark-harness/src/adapters/subprocess.rs:1 β€” `tools/benchmark-harness/src/adapters/subprocess.rs` and `tools/benchmark-harness/src/output.rs` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 11 shared commits counted here, the most recent 3 are `3ae2e348` feat(benchmark): drive docling batch via docling-jobkit; allow partia…; `0bcc6d29` feat(bench): add Tier A comparative perf metrics; `b0e609bf` fix(bench): deduplicate native batch process metrics β€” run `git show` on any of them.
  • Change coupling: extractor.rs ↔ markdown.rs crates/xberg/src/extractors/djot_format/extractor.rs:1 β€” `crates/xberg/src/extractors/djot_format/extractor.rs` and `crates/xberg/src/extractors/markdown.rs` change together 56% of the time (10 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 10 shared commits counted here, the most recent 3 are `9f85daef` fix(markup): accept UTF-8 BOMs in text documents; `a6d0cc69` fix(markdown, djot): keep each footnote reference with the block that…; `7983d223` fix(rendering): keep a footnote reference on the block that cites it β€” run `git show` on any of them.
  • Change coupling: consolidate.rs ↔ runner.rs tools/benchmark-harness/src/consolidate.rs:1 β€” `tools/benchmark-harness/src/consolidate.rs` and `tools/benchmark-harness/src/runner.rs` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 8 shared commits counted here, the most recent 3 are `e5919905` fix(bench): publish failed cells, segment rankings, and fix quality s…; `0bcc6d29` feat(bench): add Tier A comparative perf metrics; `9bcbca20` fix(bench): measure subprocess RSS directly β€” run `git show` on any of them.
  • Change coupling: docbook.rs ↔ mod.rs crates/xberg/src/extractors/docbook.rs:1 β€” `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` change together 52% of the time (12 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 12 shared commits counted here, the most recent 3 are `d26e4b42` fix(stopwords): stop panicking on a multi-byte language hint; `edf2a92e` feat(diagnostics): warn on lossy decode and empty OPML structure (#171); `e903ac53` fix(markup): recover content dropped by catch-alls in eight markup ex… β€” run `git show` on any of them.
  • Change coupling: subprocess.rs ↔ mod.rs tools/benchmark-harness/src/adapters/subprocess.rs:1 β€” `tools/benchmark-harness/src/adapters/subprocess.rs` and `tools/benchmark-harness/src/monitoring/mod.rs` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 8 shared commits counted here, the most recent 3 are `0bcc6d29` feat(bench): add Tier A comparative perf metrics (at that commit the file was still `tools/benchmark-harness/src/monitoring.rs`); `ceccfbcb` fix(bench): measure subprocess RSS after launch (at that commit the file was still `tools/benchmark-harness/src/monitoring.rs`); `7255ca3e` fix(bench): isolate resource sampling from async I/O (at that commit the file was still `tools/benchmark-harness/src/monitoring.rs`) β€” run `git show` on any of them.
  • Change coupling: mod.rs ↔ trocr.rs crates/xberg-candle-ocr/src/models/glm_ocr/mod.rs:1 β€” `crates/xberg-candle-ocr/src/models/glm_ocr/mod.rs` and `crates/xberg-candle-ocr/src/models/trocr.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, and counted over this repository's 10,000 most recent commits rather than its whole history β€” 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 5 shared commits counted here, the most recent 3 are `90d5c568` fix(candle-ocr): repair three splits that broke the build and the docs; `12d1e336` refactor(candle-ocr): split long inference-engine functions into stages; `21025dcd` fix: cap hf-hub model downloads with a wall-clock watchdog (#1228) β€” run `git show` on any of them.
D4 Β· Code Duplication Β· Duplicated block (21 lines × 2) Β· Γ—7
  • Duplicated block (21 lines × 2) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1112 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1112-1132 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1465-1485 β€” both copies are in the same file, so extract the 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/xberg-native-pdf/src/rendering/page_renderer.rs:2507 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2507-2527 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2715-2735 β€” both copies are in the same file, so extract the 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/xberg/src/core/pipeline/mod.rs:733 β€” crates/xberg/src/core/pipeline/mod.rs:733-753 | crates/xberg/src/core/pipeline/mod.rs:907-927 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/excel/open.rs:492 β€” crates/xberg/src/extraction/excel/open.rs:492-512 | crates/xberg/src/extraction/excel/open.rs:621-641 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/excel/open.rs:523 β€” crates/xberg/src/extraction/excel/open.rs:523-543 | crates/xberg/src/extraction/excel/open.rs:664-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.
  • Duplicated block (21 lines × 2) crates/xberg/src/extraction/excel/package_metadata.rs:121 β€” crates/xberg/src/extraction/excel/package_metadata.rs:121-141 | crates/xberg/src/extraction/pptx/metadata.rs:52-72 β€” before extracting anything, compare `crates/xberg/src/extraction/excel/package_metadata.rs` and `crates/xberg/src/extraction/pptx/metadata.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 56 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 (21 lines × 2) crates/xberg/src/pdf/structure/adapters.rs:1729 β€” crates/xberg/src/pdf/structure/adapters.rs:1729-1749 | crates/xberg/src/pdf/structure/pipeline.rs:1342-1362 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/adapters.rs` and `crates/xberg/src/pdf/structure/pipeline.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (15 lines × 2) Β· Γ—7
  • Duplicated block (15 lines × 2) crates/xberg-pdfium-render/src/pdf/document/page/annotation.rs:249 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation.rs:249-263 | crates/xberg-pdfium-render/src/pdf/document/page/annotation.rs:268-282 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/xberg/src/extraction/doc/mod.rs:942 β€” crates/xberg/src/extraction/doc/mod.rs:942-956 | crates/xberg/src/extraction/ppt/mod.rs:1394-1408 β€” `crates/xberg/src/extraction/doc/mod.rs` and `crates/xberg/src/extraction/ppt/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other β€” this scan matched 3 separate duplicated blocks between them, totalling at least 41 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (15 lines × 2) crates/xberg/src/extraction/docx/theme.rs:143 β€” crates/xberg/src/extraction/docx/theme.rs:143-157 | crates/xberg/src/extraction/docx/theme.rs:222-236 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/fictionbook.rs:216 β€” crates/xberg/src/extractors/fictionbook.rs:216-230 | crates/xberg/src/extractors/fictionbook.rs:344-358 β€” both copies are in the same file, so extract the 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/xberg/src/extractors/rtf/parser/formatting_extract.rs:244 β€” crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:244-258 | crates/xberg/src/extractors/rtf/parser/formatting_extract.rs:289-303 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) crates/xberg/src/paddle_ocr/model_manager.rs:767 β€” crates/xberg/src/paddle_ocr/model_manager.rs:767-781 | crates/xberg/src/paddle_ocr/model_manager.rs:812-826 β€” both copies are in the same file, so extract the 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/xberg/src/extraction/docx/table/mod.rs:638 β€” crates/xberg/src/extraction/docx/table/mod.rs:638-652 | crates/xberg/src/extraction/docx/table/mod.rs:699-713 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
PF3 Β· Async & latency hygiene Β· Awaits without ConfigureAwait(false) Β· Γ—7
  • Awaits without ConfigureAwait(false) β€” Only 0/6 awaits in library code use ConfigureAwait(false). A library that captures the caller's context can stall or deadlock its host β€” the classic way a dependency drags an app down.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:55 β€” `await Task.Run(() => { var nativeResult = NativeMethods.ClassifyChunksOwned( result...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:142 β€” `await Task.Run(() => { var nativeResult = NativeMethods.Extract( inputHandle, confi...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:185 β€” `await Task.Run(() => { var nativeResult = NativeMethods.ExtractBatch( inputsHandle,...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:241 β€” `await Task.Run(() => { var nativeResult = NativeMethods.ExtractWithExternalRedactio...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:579 β€” `await Task.Run(() => { var nativeResult = NativeMethods.MapUrl( uri, configHandle )...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
  • Awaits without ConfigureAwait(false) packages/csharp/src/Xberg/XbergConverter.cs:835 β€” `await Task.Run(() => { var nativeResult = NativeMethods.RedactExternal( documentHan...` resumes on the caller's captured context. In library code that context belongs to the host application, so a host that blocks on this call (or runs on a UI thread) can stall or deadlock β€” append `.ConfigureAwait(false)`.
D1 Β· Cyclomatic Complexity Β· FontInfo Β· Γ—6
  • FontInfo::std14_width (cyclomatic 462) crates/xberg-native-pdf/src/fonts/font_dict.rs:3358 β€” FontInfo::std14_width has cyclomatic complexity 462 (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.
  • FontInfo::char_to_unicode_uncached (cyclomatic 96) crates/xberg-native-pdf/src/fonts/font_dict.rs:4319 β€” FontInfo::char_to_unicode_uncached has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent 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: FontInfo::gid_to_standard_glyph_name (cyclomatic 219) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FontInfo::from_dict (cyclomatic 44) crates/xberg-native-pdf/src/fonts/font_dict.rs:737 β€” FontInfo::from_dict has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FontInfo::gid_to_standard_glyph_name (cyclomatic 219) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FontInfo::resolve_encoding_fields (cyclomatic 22) crates/xberg-native-pdf/src/fonts/font_dict.rs:1540 β€” FontInfo::resolve_encoding_fields has cyclomatic complexity 22 (threshold 15). Of this number, 20 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: FontInfo::gid_to_standard_glyph_name (cyclomatic 219) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FontInfo::parse_descendant_fonts (cyclomatic 20) crates/xberg-native-pdf/src/fonts/font_dict.rs:1791 β€” FontInfo::parse_descendant_fonts has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FontInfo::gid_to_standard_glyph_name (cyclomatic 219) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • FontInfo::compute_font_weight (cyclomatic 19) crates/xberg-native-pdf/src/fonts/font_dict.rs:5071 β€” FontInfo::compute_font_weight has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FontInfo::gid_to_standard_glyph_name (cyclomatic 219) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D10 Β· Test Quality Β· No assertions Β· Γ—6
  • No assertions: Test_RegisterEmbeddingBackendTraitBridge e2e/csharp/tests/PluginApiTests.cs:25 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Test_RegisterOcrBackendTraitBridge e2e/csharp/tests/PluginApiTests.cs:44 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Test_RegisterPostProcessorTraitBridge e2e/csharp/tests/PluginApiTests.cs:63 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Test_RegisterRerankerBackendTraitBridge e2e/csharp/tests/PluginApiTests.cs:82 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Test_RegisterTokenizerBackendTraitBridge e2e/csharp/tests/PluginApiTests.cs:101 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Test_RegisterValidatorTraitBridge e2e/csharp/tests/PluginApiTests.cs:120 β€” This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* β€” so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D2 Β· Cognitive Complexity Β· LatexExtractor Β· Γ—6
  • LatexExtractor::build_internal_document (cognitive 118) crates/xberg/src/extractors/latex/mod.rs:429 β€” LatexExtractor::build_internal_document has cognitive complexity 118 (threshold 15). Drivers by points: if/else 29 (98 pts), boolean chains 11, loops 3 (6 pts), match/switch 1 (3 pts) (nesting depth added 74). 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.
  • LatexExtractor::process_content_line (cognitive 81) crates/xberg/src/extractors/latex/mod.rs:929 β€” LatexExtractor::process_content_line has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 5 (14 pts), boolean chains 7 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LatexExtractor::strip_inline_commands_with_symbols (cognitive 57) crates/xberg/src/extractors/latex/mod.rs:99 β€” LatexExtractor::strip_inline_commands_with_symbols has cognitive complexity 57 (threshold 15). Drivers by points: if/else 20 (38 pts), loops 4 (13 pts), boolean chains 6 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LatexExtractor::build_internal_list_items (cognitive 40) crates/xberg/src/extractors/latex/mod.rs:1111 β€” LatexExtractor::build_internal_list_items has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • LatexExtractor::build_internal_body (cognitive 34) crates/xberg/src/extractors/latex/mod.rs:649 β€” LatexExtractor::build_internal_body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (26 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LatexExtractor::collect_heading_source (cognitive 19) crates/xberg/src/extractors/latex/mod.rs:873 β€” LatexExtractor::collect_heading_source has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (5 pts), 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.
D4 Β· Code Duplication Β· Duplicated block (5 lines × 4) Β· Γ—6
  • Duplicated block (5 lines × 4) crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:39 β€” crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:39-43 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:52-56 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_japan1.rs:35-39 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_korea1.rs:37-41 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from all 4 call sites, so a change lands once.
  • Duplicated block (5 lines × 4) crates/xberg/src/extractors/docx.rs:1347 β€” crates/xberg/src/extractors/docx.rs:1347-1351 | crates/xberg/src/extractors/odp.rs:554-558 | crates/xberg/src/extractors/odt.rs:1763-1767 | crates/xberg/src/extractors/rtf/mod.rs:388-392 β€” before extracting anything, compare `crates/xberg/src/extractors/docx.rs` and `crates/xberg/src/extractors/odp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 129 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 (5 lines × 4) crates/xberg/src/extractors/docx.rs:1354 β€” crates/xberg/src/extractors/docx.rs:1354-1358 | crates/xberg/src/extractors/odp.rs:558-562 | crates/xberg/src/extractors/odt.rs:1767-1771 | crates/xberg/src/extractors/rtf/mod.rs:395-399 β€” before extracting anything, compare `crates/xberg/src/extractors/docx.rs` and `crates/xberg/src/extractors/odp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 129 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 (5 lines × 4) crates/xberg/src/rendering/djot.rs:351 β€” crates/xberg/src/rendering/djot.rs:351-355 | crates/xberg/src/rendering/html.rs:46-50 | crates/xberg/src/rendering/markdown.rs:255-259 | crates/xberg/src/rendering/plain.rs:306-310 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from all 4 call sites, so a change lands once.
  • Duplicated block (5 lines × 4) crates/xberg-tesseract/src/api.rs:908 β€” crates/xberg-tesseract/src/api.rs:908-912 | crates/xberg-tesseract/src/api.rs:1071-1075 | crates/xberg-tesseract/src/api.rs:1103-1107 | crates/xberg-tesseract/src/page_iterator.rs:76-80 β€” 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.
  • Duplicated block (5 lines × 4) crates/xberg/src/extraction/pptx/parser.rs:229 β€” crates/xberg/src/extraction/pptx/parser.rs:229-233 | crates/xberg/src/extraction/pptx/parser.rs:375-379 | crates/xberg/src/extraction/pptx/parser.rs:388-392 | crates/xberg/src/extraction/pptx/parser.rs:461-465 β€” 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.
X2 Β· Cancellation propagation Β· Async method without CancellationToken Β· Γ—6
  • Async method without CancellationToken: ClassifyChunksOwnedAsync packages/csharp/src/Xberg/XbergConverter.cs:37 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
  • Async method without CancellationToken: ExtractAsync packages/csharp/src/Xberg/XbergConverter.cs:124 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
  • Async method without CancellationToken: ExtractBatchAsync packages/csharp/src/Xberg/XbergConverter.cs:172 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
  • Async method without CancellationToken: ExtractWithExternalRedactionAsync packages/csharp/src/Xberg/XbergConverter.cs:222 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
  • Async method without CancellationToken: MapUrlAsync packages/csharp/src/Xberg/XbergConverter.cs:567 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
  • Async method without CancellationToken: RedactExternalAsync packages/csharp/src/Xberg/XbergConverter.cs:816 β€” No CancellationToken parameter β€” this work can't be stopped early once started.
D1 Β· Cyclomatic Complexity Β· TextRasterizer Β· Γ—5
  • TextRasterizer::render_unicode_text (cyclomatic 48) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1075 β€” TextRasterizer::render_unicode_text 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.
  • TextRasterizer::load_font_data (cyclomatic 35) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:939 β€” TextRasterizer::load_font_data has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • TextRasterizer::render_text (cyclomatic 25) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:560 β€” TextRasterizer::render_text 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.
  • TextRasterizer::render_cid_direct (cyclomatic 23) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1513 β€” TextRasterizer::render_cid_direct 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.
  • TextRasterizer::render_substituted_cjk (cyclomatic 18) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1705 β€” TextRasterizer::render_substituted_cjk has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 Β· Cognitive Complexity Β· DocxParser Β· Γ—5
  • DocxParser::parse_body_elements (cognitive 394) crates/xberg/src/extraction/docx/parser.rs:2647 β€” DocxParser::parse_body_elements has cognitive complexity 394 (threshold 15). Drivers by points: if/else 84 (307 pts), loops 9 (49 pts), match/switch 6 (20 pts), boolean chains 18 (nesting depth added 277). 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.
  • DocxParser::parse_numbering (cognitive 58) crates/xberg/src/extraction/docx/parser.rs:3452 β€” DocxParser::parse_numbering has cognitive complexity 58 (threshold 15). Drivers by points: if/else 7 (29 pts), loops 6 (17 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 40). 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.
  • DocxParser::parse_notes (cognitive 29) crates/xberg/src/extraction/docx/parser.rs:3701 β€” DocxParser::parse_notes has cognitive complexity 29 (threshold 15). Drivers by points: loops 5 (19 pts), match/switch 2 (6 pts), if/else 1 (3 pts), boolean chains 1 (nesting depth added 20). 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.
  • DocxParser::parse_header_footer_relationship_targets (cognitive 24) crates/xberg/src/extraction/docx/parser.rs:3634 β€” DocxParser::parse_header_footer_relationship_targets has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (10 pts), loops 2 (4 pts) (nesting depth added 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.
  • DocxParser::parse_comments (cognitive 22) crates/xberg/src/extraction/docx/parser.rs:3762 β€” DocxParser::parse_comments has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (16 pts), match/switch 2 (6 pts) (nesting depth added 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.
D2 Β· Cognitive Complexity Β· TextRasterizer Β· Γ—5
  • TextRasterizer::render_unicode_text (cognitive 160) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1075 β€” TextRasterizer::render_unicode_text has cognitive complexity 160 (threshold 15). Drivers by points: if/else 54 (146 pts), loops 3 (8 pts), boolean chains 6 (nesting depth added 97). 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.
  • TextRasterizer::render_text (cognitive 48) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:560 β€” TextRasterizer::render_text has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 5, match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextRasterizer::render_cid_direct (cognitive 47) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1513 β€” TextRasterizer::render_cid_direct has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (39 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • TextRasterizer::load_font_data (cognitive 41) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:939 β€” TextRasterizer::load_font_data has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (25 pts), boolean chains 15, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • TextRasterizer::render_substituted_cjk (cognitive 40) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1705 β€” TextRasterizer::render_substituted_cjk has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 2, loops 1, match/switch 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.
D2 Β· Cognitive Complexity Β· JupyterExtractor Β· Γ—5
  • JupyterExtractor::terminal_text (cognitive 55) crates/xberg/src/extractors/jupyter.rs:502 β€” JupyterExtractor::terminal_text has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 6 (12 pts), match/switch 3 (6 pts), boolean chains 4 (nesting depth added 30). Of this number, 47 points are the body's own statements and 8 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.
  • JupyterExtractor::extract_data_output (cognitive 52) crates/xberg/src/extractors/jupyter.rs:669 β€” JupyterExtractor::extract_data_output has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (41 pts), loops 2 (5 pts), match/switch 1 (5 pts), boolean chains 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • JupyterExtractor::build_internal_document_with_budget (cognitive 30) crates/xberg/src/extractors/jupyter.rs:1329 β€” JupyterExtractor::build_internal_document_with_budget has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • JupyterExtractor::extract_notebook_value (cognitive 20) crates/xberg/src/extractors/jupyter.rs:180 β€” JupyterExtractor::extract_notebook_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 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.
  • JupyterExtractor::richest_output_representation (cognitive 18) crates/xberg/src/extractors/jupyter.rs:935 β€” JupyterExtractor::richest_output_representation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 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.
D30 Β· Dependency Vulnerabilities Β· Medium CVE Β· Γ—5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 Β· Code Duplication Β· Members sharing a duplicated core (5 members, 50+ identical tokens) Β· Γ—5
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:91 β€” crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:91-163 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:220-324 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:370-447 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:657-855 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:866-1068 β€” These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/xberg-pdfium-render/src/pdf/document/fonts.rs:315 β€” crates/xberg-pdfium-render/src/pdf/document/fonts.rs:315-336 | crates/xberg-pdfium-render/src/pdf/document/fonts.rs:446-467 | crates/xberg-pdfium-render/src/pdf/font.rs:229-251 | crates/xberg-pdfium-render/src/pdf/font.rs:405-427 | crates/xberg-pdfium-render/src/pdfium.rs:387-408 β€” These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py:207 β€” tools/benchmark-harness/scripts/docling_extract.py:207-223 | tools/benchmark-harness/scripts/markitdown_extract.py:40-56 | tools/benchmark-harness/scripts/mineru_extract.py:166-182 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:48-64 | tools/benchmark-harness/scripts/unstructured_extract.py:57-73 β€” These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py:227 β€” tools/benchmark-harness/scripts/docling_extract.py:227-261 | tools/benchmark-harness/scripts/markitdown_extract.py:60-94 | tools/benchmark-harness/scripts/mineru_extract.py:186-220 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:68-102 | tools/benchmark-harness/scripts/unstructured_extract.py:77-111 β€” These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/benchmark-harness/scripts/docling_extract.py:293 β€” tools/benchmark-harness/scripts/docling_extract.py:293-368 | tools/benchmark-harness/scripts/markitdown_extract.py:126-169 | tools/benchmark-harness/scripts/mineru_extract.py:308-376 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:134-177 | tools/benchmark-harness/scripts/unstructured_extract.py:143-194 β€” These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below β€” it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain β€” factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 Β· Code Duplication Β· Duplicated block (16 lines × 3) Β· Γ—5
  • Duplicated block (16 lines × 3) crates/xberg-native-pdf/src/content/parser.rs:3251 β€” crates/xberg-native-pdf/src/content/parser.rs:3251-3266 | crates/xberg-native-pdf/src/content/parser.rs:3304-3319 | crates/xberg-native-pdf/src/content/parser.rs:3362-3377 β€” 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 (16 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1757 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1757-1772 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1787-1802 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1896-1911 β€” 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 (16 lines × 3) crates/xberg-pdfium-render/src/pdf/document/page/annotations.rs:383 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotations.rs:383-398 | crates/xberg-pdfium-render/src/pdf/document/page/annotations.rs:419-434 | crates/xberg-pdfium-render/src/pdf/document/page/annotations.rs:455-470 β€” 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 (16 lines × 3) crates/xberg/src/pdf/structure/pipeline.rs:3691 β€” crates/xberg/src/pdf/structure/pipeline.rs:3691-3706 | crates/xberg/src/pdf/structure/pipeline.rs:3709-3724 | crates/xberg/src/pdf/structure/pipeline.rs:3729-3744 β€” 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 (16 lines × 3) tools/benchmark-harness/scripts/docling_extract.py:293 β€” tools/benchmark-harness/scripts/docling_extract.py:293-308 | tools/benchmark-harness/scripts/mineru_extract.py:308-323 | tools/benchmark-harness/scripts/unstructured_extract.py:143-158 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/mineru_extract.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 130 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (14 lines × 3) Β· Γ—5
  • Duplicated block (14 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs:817 β€” crates/xberg-native-pdf/src/document/extract_api.rs:817-830 | crates/xberg-native-pdf/src/document/extract_api.rs:895-908 | crates/xberg-native-pdf/src/document/extract_api.rs:911-924 β€” 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 (14 lines × 3) crates/xberg-pdfium-render/src/pdf/document/page/object/content_mark.rs:31 β€” crates/xberg-pdfium-render/src/pdf/document/page/object/content_mark.rs:31-44 | crates/xberg-pdfium-render/src/pdf/document/page/object/content_mark.rs:72-85 | crates/xberg-pdfium-render/src/pdf/document/page/object/content_mark.rs:138-151 β€” 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 (14 lines × 3) crates/xberg/src/embeddings/mod.rs:501 β€” crates/xberg/src/embeddings/mod.rs:501-514 | crates/xberg/src/late_interaction/mod.rs:413-426 | crates/xberg/src/sparse_embeddings/mod.rs:284-297 β€” `crates/xberg/src/late_interaction/mod.rs` and `crates/xberg/src/sparse_embeddings/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other β€” this scan matched 3 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (14 lines × 3) crates/xberg/src/extractors/iwork/keynote.rs:163 β€” crates/xberg/src/extractors/iwork/keynote.rs:163-176 | crates/xberg/src/extractors/iwork/pages.rs:110-123 | crates/xberg/src/extractors/iwork/pages.rs:125-138 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 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 (14 lines × 3) crates/xberg/src/plugins/registry/embedding.rs:106 β€” crates/xberg/src/plugins/registry/embedding.rs:106-119 | crates/xberg/src/plugins/registry/reranker.rs:74-87 | crates/xberg/src/plugins/registry/tokenizer.rs:96-109 β€” 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.
D4 Β· Code Duplication Β· Duplicated block (11 lines × 3) Β· Γ—5
  • Duplicated block (11 lines × 3) crates/xberg/src/extraction/archive/zip.rs:32 β€” crates/xberg/src/extraction/archive/zip.rs:32-42 | crates/xberg/src/extraction/archive/zip.rs:100-110 | crates/xberg/src/extraction/archive/zip.rs:188-198 β€” 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/xberg/src/extraction/structured.rs:258 β€” crates/xberg/src/extraction/structured.rs:258-268 | crates/xberg/src/extraction/structured.rs:477-487 | crates/xberg/src/extraction/structured.rs:589-599 β€” 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/xberg/src/extractors/fictionbook.rs:323 β€” crates/xberg/src/extractors/fictionbook.rs:323-333 | crates/xberg/src/extractors/fictionbook.rs:620-630 | crates/xberg/src/extractors/fictionbook.rs:1008-1018 β€” 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/xberg/src/extractors/pdf/mod.rs:2523 β€” crates/xberg/src/extractors/pdf/mod.rs:2523-2533 | crates/xberg/src/extractors/pdf/mod.rs:2605-2615 | crates/xberg/src/extractors/pdf/mod.rs:2881-2891 β€” 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/xberg/src/extractors/rtf/parser/text_extract.rs:404 β€” crates/xberg/src/extractors/rtf/parser/text_extract.rs:404-414 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:589-599 | crates/xberg/src/extractors/rtf/parser/text_extract.rs:627-637 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (6–7 lines × 2) Β· Γ—5
  • Duplicated block (6–7 lines × 2) crates/xberg-native-pdf/src/content/parser.rs:1472 β€” crates/xberg-native-pdf/src/content/parser.rs:1472-1478 | crates/xberg-native-pdf/src/content/parser.rs:1491-1496 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) crates/xberg/src/extractors/docbook.rs:921 β€” crates/xberg/src/extractors/docbook.rs:921-926 | crates/xberg/src/extractors/docbook.rs:1225-1231 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) crates/xberg/src/extractors/fictionbook.rs:298 β€” crates/xberg/src/extractors/fictionbook.rs:298-303 | crates/xberg/src/extractors/fictionbook.rs:308-314 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) crates/xberg/src/ocr/processor/execution.rs:2080 β€” crates/xberg/src/ocr/processor/execution.rs:2080-2086 | crates/xberg/src/sceptre_ocr/mod.rs:677-682 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6–7 lines × 2) tools/benchmark-harness/src/aggregate/ranking.rs:154 β€” tools/benchmark-harness/src/aggregate/ranking.rs:154-159 | tools/benchmark-harness/src/aggregate/ranking.rs:495-501 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D1 Β· Cyclomatic Complexity Β· RstExtractor Β· Γ—4
  • RstExtractor::build_internal_document_within (cyclomatic 182) crates/xberg/src/extractors/rst.rs:986 β€” RstExtractor::build_internal_document_within has cyclomatic complexity 182 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RstExtractor::extract_text_from_rst (cyclomatic 57) crates/xberg/src/extractors/rst.rs:236 β€” RstExtractor::extract_text_from_rst has cyclomatic complexity 57 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RstExtractor::parse_inline_markup (cyclomatic 39) crates/xberg/src/extractors/rst.rs:551 β€” RstExtractor::parse_inline_markup has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RstExtractor::is_list_item (cyclomatic 18) crates/xberg/src/extractors/rst.rs:485 β€” RstExtractor::is_list_item has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· LatexExtractor Β· Γ—4
  • LatexExtractor::build_internal_document (cyclomatic 49) crates/xberg/src/extractors/latex/mod.rs:429 β€” LatexExtractor::build_internal_document has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • LatexExtractor::process_content_line (cyclomatic 36) crates/xberg/src/extractors/latex/mod.rs:929 β€” LatexExtractor::process_content_line 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.
  • LatexExtractor::strip_inline_commands_with_symbols (cyclomatic 28) crates/xberg/src/extractors/latex/mod.rs:99 β€” LatexExtractor::strip_inline_commands_with_symbols 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.
  • LatexExtractor::build_internal_body (cyclomatic 18) crates/xberg/src/extractors/latex/mod.rs:649 β€” LatexExtractor::build_internal_body has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· benchmark_harness Β· Γ—4
  • benchmark_harness::commands::run::register_external_adapters (cyclomatic 32) tools/benchmark-harness/src/commands/run.rs:567 β€” benchmark_harness::commands::run::register_external_adapters has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • benchmark_harness::commands::validate_gt::print_issue_lists (cyclomatic 17) tools/benchmark-harness/src/commands/validate_gt.rs:16 β€” benchmark_harness::commands::validate_gt::print_issue_lists 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.
  • benchmark_harness::output::validate_result (cyclomatic 16) tools/benchmark-harness/src/output.rs:21 β€” benchmark_harness::output::validate_result 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.
  • benchmark_harness::sizes::package_measurements::measure_jar (cyclomatic 16) tools/benchmark-harness/src/sizes/package_measurements.rs:262 β€” benchmark_harness::sizes::package_measurements::measure_jar has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 Β· Cognitive Complexity Β· OrgModeExtractor Β· Γ—4
  • OrgModeExtractor::build_internal_document (cognitive 324) crates/xberg/src/extractors/orgmode.rs:340 β€” OrgModeExtractor::build_internal_document has cognitive complexity 324 (threshold 15). Drivers by points: if/else 74 (242 pts), loops 15 (45 pts), boolean chains 32, match/switch 1 (5 pts) (nesting depth added 202). 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.
  • OrgModeExtractor::parse_inline_markup (cognitive 23) crates/xberg/src/extractors/orgmode.rs:197 β€” OrgModeExtractor::parse_inline_markup has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, match/switch 1 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • OrgModeExtractor::is_structural_start (cognitive 20) crates/xberg/src/extractors/orgmode.rs:1004 β€” OrgModeExtractor::is_structural_start has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • OrgModeExtractor::next_display_math (cognitive 16) crates/xberg/src/extractors/orgmode.rs:874 β€” OrgModeExtractor::next_display_math has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
D2 Β· Cognitive Complexity Β· TypstParser Β· Γ—4
  • TypstParser::extract_content (cognitive 78) crates/xberg/src/extractors/typst.rs:1111 β€” TypstParser::extract_content has cognitive complexity 78 (threshold 15). Drivers by points: if/else 24 (59 pts), boolean chains 7, loops 3 (7 pts), match/switch 2 (5 pts) (nesting depth added 42). 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.
  • TypstParser::process_line (cognitive 31) crates/xberg/src/extractors/typst.rs:1343 β€” TypstParser::process_line has cognitive complexity 31 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 5 (13 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypstParser::extract_table_content (cognitive 27) crates/xberg/src/extractors/typst.rs:1261 β€” TypstParser::extract_table_content has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypstParser::extract_keywords (cognitive 24) crates/xberg/src/extractors/typst.rs:1076 β€” TypstParser::extract_keywords has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (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.
D2 Β· Cognitive Complexity Β· TextPostProcessor Β· Γ—4
  • TextPostProcessor::normalize_leader_dots (cognitive 42) crates/xberg-native-pdf/src/converters/text_post_processor.rs:364 β€” TextPostProcessor::normalize_leader_dots has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 5 (17 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextPostProcessor::compose_combining_marks (cognitive 24) crates/xberg-native-pdf/src/converters/text_post_processor.rs:521 β€” TextPostProcessor::compose_combining_marks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 13). Of this number, 23 points are the body's own statements and 1 belongs 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.
  • TextPostProcessor::rejoin_hyphenated_words (cognitive 22) crates/xberg-native-pdf/src/converters/text_post_processor.rs:57 β€” TextPostProcessor::rejoin_hyphenated_words has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, 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.
  • TextPostProcessor::ensure_special_char_spacing (cognitive 17) crates/xberg-native-pdf/src/converters/text_post_processor.rs:208 β€” TextPostProcessor::ensure_special_char_spacing 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.
D4 Β· Code Duplication Β· Duplicated block (16–18 lines × 2) Β· Γ—4
  • Duplicated block (16–18 lines × 2) crates/xberg-native-pdf/src/encryption/algorithms.rs:198 β€” crates/xberg-native-pdf/src/encryption/algorithms.rs:198-215 | crates/xberg-native-pdf/src/encryption/algorithms.rs:758-773 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–18 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2317 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2317-2334 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2151-2166 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (16–18 lines × 2) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1585 β€” crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1585-1602 | crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1753-1768 β€” both copies are in the same file, so extract the 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–18 lines × 2) crates/xberg/src/ocr/types.rs:269 β€” crates/xberg/src/ocr/types.rs:269-284 | crates/xberg/src/types/formats.rs:606-623 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (16–17 lines × 2) Β· Γ—4
  • Duplicated block (16–17 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1314 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1314-1330 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1414-1429 β€” both copies are in the same file, so extract the 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–17 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4354 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4354-4369 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2567-2583 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (16–17 lines × 2) crates/xberg-tesseract/src/api.rs:1615 β€” crates/xberg-tesseract/src/api.rs:1615-1630 | crates/xberg-tesseract/src/api.rs:1705-1721 β€” both copies are in the same file, so extract the 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–17 lines × 2) crates/xberg/src/extraction/pptx/container.rs:162 β€” crates/xberg/src/extraction/pptx/container.rs:162-177 | crates/xberg/src/extraction/pptx/parser.rs:922-938 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (11–13 lines × 2) Β· Γ—4
  • Duplicated block (11–13 lines × 2) crates/xberg/src/api/startup.rs:218 β€” crates/xberg/src/api/startup.rs:218-228 | crates/xberg/src/api/startup.rs:283-295 β€” both copies are in the same file, so extract the 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–13 lines × 2) crates/xberg/src/extraction/archive/zip.rs:114 β€” crates/xberg/src/extraction/archive/zip.rs:114-126 | crates/xberg/src/extraction/archive/zip.rs:201-211 β€” both copies are in the same file, so extract the 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–13 lines × 2) crates/xberg/src/extractors/epub/content.rs:701 β€” crates/xberg/src/extractors/epub/content.rs:701-713 | crates/xberg/src/utils/xml_utils.rs:232-242 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–13 lines × 2) crates/xberg/src/pdf/structure/classify.rs:1763 β€” crates/xberg/src/pdf/structure/classify.rs:1763-1775 | crates/xberg/src/pdf/structure/classify.rs:1830-1840 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (12 lines × 3) Β· Γ—4
  • Duplicated block (12 lines × 3) crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:210 β€” crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:210-221 | crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:235-246 | crates/xberg-native-pdf/src/structure/converter.rs:107-118 β€” before extracting anything, compare `crates/xberg-native-pdf/src/extractors/synthetic_structure.rs` and `crates/xberg-native-pdf/src/structure/converter.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 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 (12 lines × 3) crates/xberg/src/extractors/docx.rs:1380 β€” crates/xberg/src/extractors/docx.rs:1380-1391 | crates/xberg/src/extractors/odp.rs:585-596 | crates/xberg/src/extractors/odt.rs:1794-1805 β€” before extracting anything, compare `crates/xberg/src/extractors/docx.rs` and `crates/xberg/src/extractors/odp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 129 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 (12 lines × 3) crates/xberg/src/pdf/structure/lines.rs:121 β€” crates/xberg/src/pdf/structure/lines.rs:121-135 | tools/benchmark-harness/src/noise_detection/mod.rs:313-324 | tools/benchmark-harness/src/quality/mod.rs:387-404 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (12 lines × 3) tools/benchmark-harness/scripts/docling_extract.py:326 β€” tools/benchmark-harness/scripts/docling_extract.py:326-337 | tools/benchmark-harness/scripts/mineru_extract.py:328-339 | tools/benchmark-harness/scripts/unstructured_extract.py:163-174 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/mineru_extract.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 130 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (11–12 lines × 2) Β· Γ—4
  • Duplicated block (11–12 lines × 2) crates/xberg-gliner/src/decode.rs:209 β€” crates/xberg-gliner/src/decode.rs:209-220 | crates/xberg-gliner/src/v2/decode.rs:36-46 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–12 lines × 2) crates/xberg/src/embeddings/mod.rs:763 β€” crates/xberg/src/embeddings/mod.rs:763-774 | crates/xberg/src/embeddings/mod.rs:1064-1074 β€” both copies are in the same file, so extract the 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–12 lines × 2) crates/xberg/src/extractors/fictionbook.rs:429 β€” crates/xberg/src/extractors/fictionbook.rs:429-440 | crates/xberg/src/extractors/jats/mod.rs:512-522 β€” before extracting anything, compare `crates/xberg/src/extractors/fictionbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11–12 lines × 2) crates/xberg/src/extractors/latex/mod.rs:525 β€” crates/xberg/src/extractors/latex/mod.rs:525-536 | crates/xberg/src/extractors/latex/mod.rs:549-559 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (10 lines × 3) Β· Γ—4
  • Duplicated block (10 lines × 3) crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:199 β€” crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:199-208 | crates/xberg-native-pdf/src/extractors/synthetic_structure.rs:225-234 | crates/xberg-native-pdf/src/structure/converter.rs:96-105 β€” before extracting anything, compare `crates/xberg-native-pdf/src/extractors/synthetic_structure.rs` and `crates/xberg-native-pdf/src/structure/converter.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) crates/xberg/src/extractors/rtf/parser/mod.rs:124 β€” crates/xberg/src/extractors/rtf/parser/mod.rs:124-133 | crates/xberg/src/extractors/rtf/parser/mod.rs:186-195 | crates/xberg/src/extractors/rtf/parser/mod.rs:208-217 β€” 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 (10 lines × 3) crates/xberg-native-pdf/src/lib.rs:224 β€” crates/xberg-native-pdf/src/lib.rs:224-233 | crates/xberg/src/engine/structured/prompts.rs:33-42 | crates/xberg/src/text/summarization/llm.rs:47-56 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2146 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2146-2155 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2244-2253 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2359-2368 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (9 lines × 4) Β· Γ—4
  • Duplicated block (9 lines × 4) crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:91 β€” crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_cns1.rs:91-99 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:130-138 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_japan1.rs:79-87 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_korea1.rs:85-93 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from all 4 call sites, so a change lands once.
  • Duplicated block (9 lines × 4) crates/xberg-native-pdf/src/fonts/encoding.rs:294 β€” crates/xberg-native-pdf/src/fonts/encoding.rs:294-302 | crates/xberg-native-pdf/src/fonts/font_dict.rs:5658-5666 | crates/xberg-native-pdf/src/fonts/font_dict.rs:5828-5836 | crates/xberg/src/extractors/rtf/encoding.rs:47-55 β€” before extracting anything, compare `crates/xberg-native-pdf/src/fonts/encoding.rs` and `crates/xberg-native-pdf/src/fonts/font_dict.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) crates/xberg/src/extraction/email/eml.rs:78 β€” crates/xberg/src/extraction/email/eml.rs:78-86 | crates/xberg/src/extraction/email/eml.rs:87-95 | crates/xberg/src/extraction/email/eml.rs:96-104 | crates/xberg/src/extraction/email/eml.rs:109-118 β€” 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 (9 lines × 4) crates/xberg-native-pdf/src/document/extract_api.rs:816 β€” crates/xberg-native-pdf/src/document/extract_api.rs:816-824 | crates/xberg-native-pdf/src/document/extract_api.rs:832-840 | crates/xberg-native-pdf/src/document/extract_api.rs:894-902 | crates/xberg-native-pdf/src/document/extract_api.rs:910-918 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (9 lines × 3) Β· Γ—4
  • Duplicated block (9 lines × 3) crates/xberg-native-pdf/src/encryption/algorithms.rs:81 β€” crates/xberg-native-pdf/src/encryption/algorithms.rs:81-90 | crates/xberg-native-pdf/src/encryption/algorithms.rs:415-424 | crates/xberg-native-pdf/src/encryption/algorithms.rs:684-692 β€” 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 (9 lines × 3) crates/xberg-native-pdf/src/rendering/resolution/color.rs:232 β€” crates/xberg-native-pdf/src/rendering/resolution/color.rs:232-240 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:285-293 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:336-344 β€” 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 (9 lines × 3) crates/xberg/src/extractors/fictionbook.rs:603 β€” crates/xberg/src/extractors/fictionbook.rs:603-611 | crates/xberg/src/extractors/fictionbook.rs:990-999 | crates/xberg/src/extractors/jats/elements.rs:245-254 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) crates/xberg-native-pdf/src/fonts/font_dict.rs:1356 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:1356-1364 | crates/xberg-native-pdf/src/fonts/font_dict.rs:1385-1395 | crates/xberg-native-pdf/src/fonts/font_dict.rs:1425-1433 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (7–8 lines × 2) Β· Γ—4
  • Duplicated block (7–8 lines × 2) crates/xberg-native-pdf/src/fonts/unicode_decode.rs:595 β€” crates/xberg-native-pdf/src/fonts/unicode_decode.rs:595-601 | crates/xberg-native-pdf/src/fonts/unicode_decode.rs:646-653 β€” both copies are in the same file, so extract the 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–8 lines × 2) crates/xberg/src/extraction/html/structure.rs:382 β€” crates/xberg/src/extraction/html/structure.rs:382-388 | crates/xberg/src/extraction/html/structure.rs:423-430 β€” both copies are in the same file, so extract the 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–8 lines × 2) crates/xberg/src/extractors/docx.rs:664 β€” crates/xberg/src/extractors/docx.rs:664-671 | crates/xberg/src/extractors/wordperfect.rs:636-642 β€” 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–8 lines × 2) crates/xberg/src/extractors/xml.rs:81 β€” crates/xberg/src/extractors/xml.rs:81-88 | crates/xberg/src/extractors/xml.rs:128-134 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D1 Β· Cyclomatic Complexity Β· OrgModeExtractor Β· Γ—3
  • OrgModeExtractor::build_internal_document (cyclomatic 116) crates/xberg/src/extractors/orgmode.rs:340 β€” OrgModeExtractor::build_internal_document has cyclomatic complexity 116 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • OrgModeExtractor::parse_inline_markup (cyclomatic 16) crates/xberg/src/extractors/orgmode.rs:197 β€” OrgModeExtractor::parse_inline_markup 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.
  • OrgModeExtractor::is_structural_start (cyclomatic 16) crates/xberg/src/extractors/orgmode.rs:1004 β€” OrgModeExtractor::is_structural_start has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· JupyterExtractor Β· Γ—3
  • JupyterExtractor::terminal_text (cyclomatic 29) crates/xberg/src/extractors/jupyter.rs:502 β€” JupyterExtractor::terminal_text has cyclomatic complexity 29 (threshold 15). Of this number, 24 points are the body's own statements and 5 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.
  • JupyterExtractor::extract_data_output (cyclomatic 21) crates/xberg/src/extractors/jupyter.rs:669 β€” JupyterExtractor::extract_data_output 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.
  • JupyterExtractor::build_internal_document_with_budget (cyclomatic 16) crates/xberg/src/extractors/jupyter.rs:1329 β€” JupyterExtractor::build_internal_document_with_budget has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 Β· Cognitive Complexity Β· TypstExtractor Β· Γ—3
  • TypstExtractor::build_internal_document (cognitive 192) crates/xberg/src/extractors/typst.rs:87 β€” TypstExtractor::build_internal_document has cognitive complexity 192 (threshold 15). Drivers by points: if/else 55 (146 pts), loops 7 (20 pts), match/switch 8 (18 pts), boolean chains 8 (nesting depth added 114). 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.
  • TypstExtractor::parse_inline_annotations (cognitive 30) crates/xberg/src/extractors/typst.rs:787 β€” TypstExtractor::parse_inline_annotations has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TypstExtractor::explicit_table_header_range (cognitive 17) crates/xberg/src/extractors/typst.rs:601 β€” TypstExtractor::explicit_table_header_range has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· XfaParser Β· Γ—3
  • XfaParser::parse_template (cognitive 81) crates/xberg-native-pdf/src/xfa/parser.rs:309 β€” XfaParser::parse_template has cognitive complexity 81 (threshold 15). Drivers by points: if/else 18 (63 pts), match/switch 4 (13 pts), boolean chains 4, loops 1 (nesting depth added 54). 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.
  • XfaParser::apply_dataset_values (cognitive 27) crates/xberg-native-pdf/src/xfa/parser.rs:506 β€” XfaParser::apply_dataset_values has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 5 (11 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.
  • XfaParser::parse_datasets (cognitive 16) crates/xberg-native-pdf/src/xfa/parser.rs:463 β€” XfaParser::parse_datasets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· Document Β· Γ—3
  • Document::to_plain_text (cognitive 51) crates/xberg/src/extraction/docx/parser.rs:709 β€” Document::to_plain_text has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (38 pts), loops 4 (8 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 30). 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.
  • Document::to_markdown (cognitive 46) crates/xberg/src/extraction/docx/parser.rs:612 β€” Document::to_markdown has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 4 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 28). 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.
  • Document::resolve_heading_level (cognitive 20) crates/xberg/src/extraction/docx/parser.rs:520 β€” Document::resolve_heading_level has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes β€” or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 Β· Cognitive Complexity Β· LatexParser Β· Γ—3
  • LatexParser::process_environments (cognitive 24) crates/xberg/src/extractors/latex/parser.rs:109 β€” LatexParser::process_environments has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • LatexParser::parse (cognitive 23) crates/xberg/src/extractors/latex/parser.rs:35 β€” LatexParser::parse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, 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.
  • LatexParser::process_sections_and_content (cognitive 16) crates/xberg/src/extractors/latex/parser.rs:183 β€” LatexParser::process_sections_and_content has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
D2 Β· Cognitive Complexity Β· AsciiDocParser Β· Γ—3
  • AsciiDocParser::substitute_attributes (cognitive 22) crates/xberg/src/extractors/asciidoc.rs:662 β€” AsciiDocParser::substitute_attributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 7, 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.
  • AsciiDocParser::parse_inline (cognitive 19) crates/xberg/src/extractors/asciidoc.rs:719 β€” AsciiDocParser::parse_inline has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • AsciiDocParser::parse_block (cognitive 18) crates/xberg/src/extractors/asciidoc.rs:213 β€” AsciiDocParser::parse_block has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 3. To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· DocumentExtractorRegistry Β· Γ—3
  • DocumentExtractorRegistry::get_candidates (cognitive 22) crates/xberg/src/plugins/registry/extractor.rs:337 β€” DocumentExtractorRegistry::get_candidates has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (7 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.
  • DocumentExtractorRegistry::register_entry (cognitive 19) crates/xberg/src/plugins/registry/extractor.rs:186 β€” DocumentExtractorRegistry::register_entry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • DocumentExtractorRegistry::get_registered (cognitive 19) crates/xberg/src/plugins/registry/extractor.rs:287 β€” DocumentExtractorRegistry::get_registered has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· xberg_pdfium_render Β· Γ—3
  • xberg_pdfium_render::pdf::document::page::text::filter_generated_spaces_direct (cognitive 21) crates/xberg-pdfium-render/src/pdf/document/page/text.rs:100 β€” xberg_pdfium_render::pdf::document::page::text::filter_generated_spaces_direct has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • xberg_pdfium_render::pdf::document::page::object::private::internal::remove_object_from_annotation_impl (cognitive 19) crates/xberg-pdfium-render/src/pdf/document/page/object/private.rs:341 β€” xberg_pdfium_render::pdf::document::page::object::private::internal::remove_object_from_annotation_impl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts) (nesting depth added 9). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • xberg_pdfium_render::font_provider::map_font_callback (cognitive 16) crates/xberg-pdfium-render/src/font_provider.rs:126 β€” xberg_pdfium_render::font_provider::map_font_callback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 Β· Code Duplication Β· Duplicated block (23 lines × 2) Β· Γ—3
  • Duplicated block (23 lines × 2) crates/xberg-native-pdf/src/fonts/font_dict.rs:3607 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:3607-3629 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3770-3792 β€” both copies are in the same file, so extract the 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 (23 lines × 2) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1818 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1818-1840 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1896-1918 β€” both copies are in the same file, so extract the 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 (23 lines × 2) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1857 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1857-1879 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1951-1973 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (22 lines × 2) Β· Γ—3
  • Duplicated block (22 lines × 2) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:2234 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:2234-2255 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:2312-2333 β€” both copies are in the same file, so extract the 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 (22 lines × 2) crates/xberg/src/core/pipeline/mod.rs:567 β€” crates/xberg/src/core/pipeline/mod.rs:567-588 | crates/xberg/src/core/pipeline/mod.rs:840-861 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (22 lines × 2) crates/xberg/src/core/pipeline/mod.rs:613 β€” crates/xberg/src/core/pipeline/mod.rs:613-634 | crates/xberg/src/core/pipeline/mod.rs:876-897 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (17–18 lines × 2) Β· Γ—3
  • Duplicated block (17–18 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3323 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:3323-3340 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3456-3472 β€” both copies are in the same file, so extract the 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–18 lines × 2) crates/xberg/src/extractors/odp.rs:132 β€” crates/xberg/src/extractors/odp.rs:132-148 | crates/xberg/src/extractors/odt.rs:617-634 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 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 (17–18 lines × 2) crates/xberg/src/extractors/pdf/mod.rs:2480 β€” crates/xberg/src/extractors/pdf/mod.rs:2480-2496 | crates/xberg/src/extractors/pdf/mod.rs:2801-2818 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (14–16 lines × 2) Β· Γ—3
  • Duplicated block (14–16 lines × 2) crates/xberg-native-pdf/src/fonts/cff_encoding.rs:620 β€” crates/xberg-native-pdf/src/fonts/cff_encoding.rs:620-635 | crates/xberg-native-pdf/src/fonts/cff_encoding.rs:713-726 β€” both copies are in the same file, so extract the 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–16 lines × 2) crates/xberg-native-pdf/src/parser.rs:348 β€” crates/xberg-native-pdf/src/parser.rs:348-361 | crates/xberg-native-pdf/src/parser.rs:376-391 β€” both copies are in the same file, so extract the 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–16 lines × 2) crates/xberg/src/extractors/image.rs:3844 β€” crates/xberg/src/extractors/image.rs:3844-3859 | crates/xberg/src/extractors/image.rs:3867-3880 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (12–13 lines × 2) Β· Γ—3
  • Duplicated block (12–13 lines × 2) crates/xberg/src/extractors/fictionbook.rs:144 β€” crates/xberg/src/extractors/fictionbook.rs:144-155 | crates/xberg/src/extractors/jats/parser.rs:124-136 β€” before extracting anything, compare `crates/xberg/src/extractors/fictionbook.rs` and `crates/xberg/src/extractors/jats/parser.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 (12–13 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2915 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2915-2926 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3046-3058 β€” both copies are in the same file, so extract the 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–13 lines × 2) tools/benchmark-harness/src/runner/execution.rs:306 β€” tools/benchmark-harness/src/runner/execution.rs:306-318 | tools/benchmark-harness/src/runner/execution.rs:525-536 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (9–10 lines × 2) Β· Γ—3
  • Duplicated block (9–10 lines × 2) crates/xberg-native-pdf/src/optional_content.rs:170 β€” crates/xberg-native-pdf/src/optional_content.rs:170-178 | crates/xberg-native-pdf/src/structure/parser.rs:112-121 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–10 lines × 2) crates/xberg/src/extractors/image.rs:3821 β€” crates/xberg/src/extractors/image.rs:3821-3829 | crates/xberg/src/extractors/image.rs:3886-3895 β€” both copies are in the same file, so extract the 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–10 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1497 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1497-1506 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1633-1641 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (8–9 lines × 2) Β· Γ—3
  • Duplicated block (8–9 lines × 2) crates/xberg/src/embeddings/engine.rs:126 β€” crates/xberg/src/embeddings/engine.rs:126-134 | crates/xberg/src/late_interaction/engine.rs:207-214 β€” 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–9 lines × 2) crates/xberg/src/extractors/image.rs:551 β€” crates/xberg/src/extractors/image.rs:551-558 | crates/xberg/src/ocr/layout_assembly.rs:410-418 β€” 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–9 lines × 2) crates/xberg/src/extractors/markdown.rs:755 β€” crates/xberg/src/extractors/markdown.rs:755-762 | crates/xberg/src/extractors/markdown.rs:777-785 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 4) Β· Γ—3
  • Duplicated block (8 lines × 4) crates/xberg/src/embeddings/engine.rs:129 β€” crates/xberg/src/embeddings/engine.rs:129-136 | crates/xberg/src/late_interaction/engine.rs:209-216 | crates/xberg/src/reranking/engine.rs:275-282 | crates/xberg/src/sparse_embeddings/engine.rs:127-134 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (8 lines × 4) crates/xberg/src/extractors/docbook.rs:279 β€” crates/xberg/src/extractors/docbook.rs:279-286 | crates/xberg/src/extractors/docbook.rs:560-567 | crates/xberg/src/extractors/fictionbook.rs:577-584 | crates/xberg/src/extractors/jats/mod.rs:248-255 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) crates/xberg/src/extractors/docbook.rs:1047 β€” crates/xberg/src/extractors/docbook.rs:1047-1054 | crates/xberg/src/extractors/fictionbook.rs:54-61 | crates/xberg/src/extractors/fictionbook.rs:395-402 | crates/xberg/src/extractors/fictionbook.rs:462-469 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (5 lines × 5) Β· Γ—3
  • Duplicated block (5 lines × 5) crates/xberg-tesseract/src/api.rs:795 β€” crates/xberg-tesseract/src/api.rs:795-799 | crates/xberg-tesseract/src/api.rs:824-828 | crates/xberg-tesseract/src/api.rs:1331-1335 | crates/xberg-tesseract/src/api.rs:1346-1350 | crates/xberg-tesseract/src/monitor.rs:34-38 β€” there are 5 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 5) crates/xberg/src/extractors/markdown.rs:318 β€” crates/xberg/src/extractors/markdown.rs:318-322 | crates/xberg/src/extractors/markdown.rs:348-352 | crates/xberg/src/extractors/markdown.rs:378-382 | crates/xberg/src/extractors/markdown.rs:408-412 | crates/xberg/src/extractors/markdown.rs:438-442 β€” all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 5) tools/benchmark-harness/scripts/docling_extract.py:24 β€” tools/benchmark-harness/scripts/docling_extract.py:24-28 | tools/benchmark-harness/scripts/markitdown_extract.py:17-21 | tools/benchmark-harness/scripts/mineru_extract.py:53-57 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:21-25 | tools/benchmark-harness/scripts/unstructured_extract.py:18-22 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/markitdown_extract.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 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. 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.
D1 Β· Cyclomatic Complexity Β· DocxParser Β· Γ—2
  • DocxParser::parse_body_elements (cyclomatic 184) crates/xberg/src/extraction/docx/parser.rs:2647 β€” DocxParser::parse_body_elements has cyclomatic complexity 184 (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.
  • DocxParser::parse_numbering (cyclomatic 28) crates/xberg/src/extraction/docx/parser.rs:3452 β€” DocxParser::parse_numbering has cyclomatic complexity 28 (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.
D1 Β· Cyclomatic Complexity Β· ExtractionConfig Β· Γ—2
  • ExtractionConfig::with_file_overrides (cyclomatic 37) crates/xberg/src/core/config/extraction/core.rs:738 β€” ExtractionConfig::with_file_overrides has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ExtractionConfig::validate (cyclomatic 16) crates/xberg/src/core/config/extraction/core.rs:1030 β€” ExtractionConfig::validate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· TypstParser Β· Γ—2
  • TypstParser::extract_content (cyclomatic 37) crates/xberg/src/extractors/typst.rs:1111 β€” TypstParser::extract_content 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.
  • TypstParser::extract_table_content (cyclomatic 24) crates/xberg/src/extractors/typst.rs:1261 β€” TypstParser::extract_table_content has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 Β· Cyclomatic Complexity Β· Document Β· Γ—2
  • Document::to_plain_text (cyclomatic 23) crates/xberg/src/extraction/docx/parser.rs:709 β€” Document::to_plain_text has cyclomatic complexity 23 (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.
  • Document::to_markdown (cyclomatic 20) crates/xberg/src/extraction/docx/parser.rs:612 β€” Document::to_markdown has cyclomatic complexity 20 (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.
D1 Β· Cyclomatic Complexity Β· HtmlExtractor Β· Γ—2
  • HtmlExtractor::walk_nodes (cyclomatic 22) crates/xberg/src/extractors/html.rs:79 β€” HtmlExtractor::walk_nodes 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.
  • HtmlExtractor::extract_sync (cyclomatic 21) crates/xberg/src/extractors/html.rs:622 β€” HtmlExtractor::extract_sync has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 Β· Cyclomatic Complexity Β· ColorResolver Β· Γ—2
  • ColorResolver::resolve_iccbased (cyclomatic 21) crates/xberg-native-pdf/src/rendering/resolution/color.rs:175 β€” ColorResolver::resolve_iccbased 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.
  • ColorResolver::resolve_separation_or_devicen (cyclomatic 17) crates/xberg-native-pdf/src/rendering/resolution/color.rs:389 β€” ColorResolver::resolve_separation_or_devicen has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 Β· Cognitive Complexity Β· Table Β· Γ—2
  • Table::render_text (cognitive 58) crates/xberg-native-pdf/src/structure/table_extractor.rs:143 β€” Table::render_text has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 9 (13 pts), boolean chains 6 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Table::to_markdown (cognitive 16) crates/xberg/src/extraction/docx/parser.rs:1241 β€” Table::to_markdown has cognitive complexity 16 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 4 (5 pts) (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes β€” or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 Β· Cognitive Complexity Β· PptxExtractor Β· Γ—2
  • PptxExtractor::push_markdown_content (cognitive 50) crates/xberg/src/extractors/pptx.rs:236 β€” PptxExtractor::push_markdown_content has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (41 pts), match/switch 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PptxExtractor::build_internal_document (cognitive 17) crates/xberg/src/extractors/pptx.rs:164 β€” PptxExtractor::build_internal_document has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 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.
D2 Β· Cognitive Complexity Β· PaddleOCRVLModel Β· Γ—2
  • PaddleOCRVLModel::get_rope_index (cognitive 47) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:650 β€” PaddleOCRVLModel::get_rope_index has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (41 pts), loops 2 (6 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PaddleOCRVLModel::forward (cognitive 21) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:858 β€” PaddleOCRVLModel::forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· RedactionPass Β· Γ—2
  • RedactionPass::redact_format_metadata (cognitive 41) crates/xberg/src/text/redaction/engine.rs:774 β€” RedactionPass::redact_format_metadata has cognitive complexity 41 (threshold 15). Drivers by points: loops 14 (30 pts), if/else 5 (10 pts), match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RedactionPass::redact_pages (cognitive 23) crates/xberg/src/text/redaction/engine.rs:549 β€” RedactionPass::redact_pages has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (17 pts), if/else 3 (6 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 Β· Cognitive Complexity Β· ExtractionConfig Β· Γ—2
  • ExtractionConfig::with_file_overrides (cognitive 36) crates/xberg/src/core/config/extraction/core.rs:738 β€” ExtractionConfig::with_file_overrides has cognitive complexity 36 (threshold 15). Drivers by points: if/else 36. 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.
  • ExtractionConfig::validate (cognitive 17) crates/xberg/src/core/config/extraction/core.rs:1030 β€” ExtractionConfig::validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 Β· Cognitive Complexity Β· HtmlExtractor Β· Γ—2
  • HtmlExtractor::walk_nodes (cognitive 30) crates/xberg/src/extractors/html.rs:79 β€” HtmlExtractor::walk_nodes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HtmlExtractor::extract_sync (cognitive 22) crates/xberg/src/extractors/html.rs:622 β€” HtmlExtractor::extract_sync has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), match/switch 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· YoloModel Β· Γ—2
  • YoloModel::run_yolov10 (cognitive 30) crates/xberg/src/layout/models/yolo.rs:100 β€” YoloModel::run_yolov10 has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (7 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.
  • YoloModel::run_yolox (cognitive 21) crates/xberg/src/layout/models/yolo.rs:220 β€” YoloModel::run_yolox has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 5 (9 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· TextChunks Β· Γ—2
  • TextChunks::binary_search_next_chunk (cognitive 29) crates/xberg/src/chunking/text_splitter/splitter.rs:403 β€” TextChunks::binary_search_next_chunk has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TextChunks::update_next_sections (cognitive 21) crates/xberg/src/chunking/text_splitter/splitter.rs:601 β€” TextChunks::update_next_sections has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· Slide Β· Γ—2
  • Slide::to_internal_elements (cognitive 28) crates/xberg/src/extraction/pptx/elements.rs:414 β€” Slide::to_internal_elements has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Slide::to_markdown (cognitive 17) crates/xberg/src/extraction/pptx/elements.rs:352 β€” Slide::to_markdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· SubprocessAdapter Β· Γ—2
  • SubprocessAdapter::parse_output (cognitive 22) tools/benchmark-harness/src/adapters/subprocess/single_exec.rs:155 β€” SubprocessAdapter::parse_output has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • SubprocessAdapter::request_args_from (cognitive 18) tools/benchmark-harness/src/adapters/subprocess/ocr_args.rs:260 β€” SubprocessAdapter::request_args_from has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 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.
D3 Β· God Classes Β· TooManyFunctions Β· Γ—2
  • TooManyFunctions: xberg::rendering::common crates/xberg/src/rendering/common.rs:13 β€” TooManyFunctions β€” 32 free functions. The bar is 30 free functions; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyFunctions: xberg::pdf::render crates/xberg/src/pdf/render.rs:100 β€” TooManyFunctions β€” 31 free functions. The bar is 30 free functions; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D30 Β· Dependency Vulnerabilities Β· Medium vulnerability Β· Γ—2
  • REDACTED
  • REDACTED
D4 Β· Code Duplication Β· Near-duplicate member pair (31 shared lines) Β· Γ—2
  • Near-duplicate member pair (31 shared lines) crates/xberg/src/extractors/latex/mod.rs:429 β€” crates/xberg/src/extractors/latex/mod.rs:429-646 | crates/xberg/src/extractors/latex/mod.rs:654-743 β€” These two members are variants of one another: 31 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 (31 shared lines) crates/xberg-native-pdf/src/structure/traversal.rs:289 β€” crates/xberg-native-pdf/src/structure/traversal.rs:289-364 | crates/xberg-native-pdf/src/structure/traversal.rs:404-477 β€” These two members are variants of one another: 31 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Edited copy of a member (43 corresponding lines) Β· Γ—2
  • Edited copy of a member (43 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs:59 β€” crates/xberg/src/extraction/doc/metadata.rs:59-108 | crates/xberg/src/extraction/ppt/mod.rs:1451-1505 β€” These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below β€” the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain β€” factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) crates/xberg-native-pdf/src/text/kangxi.rs:57 β€” crates/xberg-native-pdf/src/text/kangxi.rs:57-102 | crates/xberg-native-pdf/src/text/kangxi.rs:106-148 β€” These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below β€” the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain β€” factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 Β· Code Duplication Β· Edited copy of a member (11 corresponding lines) Β· Γ—2
  • Edited copy of a member (11 corresponding lines) crates/xberg/src/extraction/image.rs:295 β€” crates/xberg/src/extraction/image.rs:295-369 | crates/xberg/src/pdf/native/images.rs:86-134 β€” 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/xberg/src/layout/models/slanet.rs:170 β€” crates/xberg/src/layout/models/slanet.rs:170-180 | crates/xberg/src/layout/models/tatr.rs:191-201 β€” These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below β€” the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain β€” factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 Β· Code Duplication Β· Edited copy of a member (18 corresponding lines) Β· Γ—2
  • Edited copy of a member (18 corresponding lines) crates/xberg-native-pdf/src/document/mod.rs:1045 β€” crates/xberg-native-pdf/src/document/mod.rs:1045-1148 | crates/xberg-native-pdf/src/rendering/sidecar.rs:1441-1638 β€” 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/xberg-native-pdf/src/rendering/page_renderer.rs:4352 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4352-4481 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2565-2584 β€” 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 Β· Members sharing a duplicated core (7 members, 50+ identical tokens) Β· Γ—2
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg-tesseract/src/api.rs:495 β€” crates/xberg-tesseract/src/api.rs:495-508 | crates/xberg-tesseract/src/api.rs:519-529 | crates/xberg-tesseract/src/api.rs:540-550 | crates/xberg-tesseract/src/api.rs:632-642 | crates/xberg-tesseract/src/api.rs:653-663 | crates/xberg-tesseract/src/api.rs:674-684 | crates/xberg-tesseract/src/api.rs:691-701 β€” These 7 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 7 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 7 times.
  • Members sharing a duplicated core (7 members, 50+ identical tokens) crates/xberg/src/extractors/doc.rs:75 β€” crates/xberg/src/extractors/doc.rs:75-145 | crates/xberg/src/extractors/excel.rs:382-449 | crates/xberg/src/extractors/iwork/keynote.rs:199-236 | crates/xberg/src/extractors/iwork/numbers.rs:1330-1367 | crates/xberg/src/extractors/iwork/pages.rs:162-199 | crates/xberg/src/extractors/ppt.rs:77-102 | crates/xberg/src/extractors/pptx.rs:489-602 β€” These 7 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 7 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 7 times.
D4 Β· Code Duplication Β· Duplicated block (47 lines × 2) Β· Γ—2
  • Duplicated block (47 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3596 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3596-3642 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:3681-3727 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (47 lines × 2) crates/xberg/src/ocr/tesseract_backend.rs:431 β€” crates/xberg/src/ocr/tesseract_backend.rs:431-477 | crates/xberg/src/ocr/tesseract_backend.rs:530-576 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (43 lines × 2) Β· Γ—2
  • Duplicated block (43 lines × 2) crates/xberg/src/extraction/doc/metadata.rs:60 β€” crates/xberg/src/extraction/doc/metadata.rs:60-102 | crates/xberg/src/extraction/ppt/mod.rs:1458-1500 β€” before extracting anything, compare `crates/xberg/src/extraction/doc/metadata.rs` and `crates/xberg/src/extraction/ppt/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 81 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 (43 lines × 2) tools/benchmark-harness/src/json_quality.rs:145 β€” tools/benchmark-harness/src/json_quality.rs:145-187 | tools/benchmark-harness/src/json_quality.rs:355-397 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (38 lines × 2) Β· Γ—2
  • Duplicated block (38 lines × 2) crates/xberg-tesseract/src/mutable_iterator.rs:82 β€” crates/xberg-tesseract/src/mutable_iterator.rs:82-119 | crates/xberg-tesseract/src/result_iterator.rs:187-224 β€” 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 (38 lines × 2) crates/xberg/src/core/extractor/bytes.rs:102 β€” crates/xberg/src/core/extractor/bytes.rs:102-139 | crates/xberg/src/core/extractor/file.rs:245-282 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (32 lines × 2) Β· Γ—2
  • Duplicated block (32 lines × 2) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1906 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1906-1937 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1961-1992 β€” both copies are in the same file, so extract the 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 (32 lines × 2) crates/xberg/src/extractors/odp.rs:568 β€” crates/xberg/src/extractors/odp.rs:568-599 | crates/xberg/src/extractors/odt.rs:1777-1808 β€” before extracting anything, compare `crates/xberg/src/extractors/odp.rs` and `crates/xberg/src/extractors/odt.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 218 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (22–25 lines × 2) Β· Γ—2
  • Duplicated block (22–25 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1511 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1511-1535 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1742-1763 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 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 (22–25 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4966 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4966-4990 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6201-6222 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (25 lines × 2) Β· Γ—2
  • Duplicated block (25 lines × 2) crates/xberg/src/core/config/ocr.rs:23 β€” crates/xberg/src/core/config/ocr.rs:23-47 | crates/xberg/src/types/formats.rs:17-41 β€” 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 (25 lines × 2) tools/benchmark-harness/scripts/markitdown_extract.py:126 β€” tools/benchmark-harness/scripts/markitdown_extract.py:126-150 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:134-158 β€” before extracting anything, compare `tools/benchmark-harness/scripts/markitdown_extract.py` and `tools/benchmark-harness/scripts/pymupdf4llm_extract.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (24 lines × 2) Β· Γ—2
  • Duplicated block (24 lines × 2) crates/xberg/src/pdf/structure/pipeline.rs:2292 β€” crates/xberg/src/pdf/structure/pipeline.rs:2292-2315 | crates/xberg/src/pdf/structure/pipeline.rs:2358-2381 β€” both copies are in the same file, so extract the 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) scripts/ci/ruby/vendor-xberg-core.py:133 β€” scripts/ci/ruby/vendor-xberg-core.py:133-156 | scripts/ci/ruby/vendor-xberg-core.py:158-181 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (20–21 lines × 2) Β· Γ—2
  • Duplicated block (20–21 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:124 β€” crates/xberg-native-pdf/src/document/extract_api.rs:124-143 | crates/xberg-native-pdf/src/document/extract_api.rs:1203-1223 β€” both copies are in the same file, so extract the 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–21 lines × 2) tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:130 β€” tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:130-150 | tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:165-184 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand β€” widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 Β· Code Duplication Β· Duplicated block (18–19 lines × 2) Β· Γ—2
  • Duplicated block (18–19 lines × 2) crates/xberg/src/pdf/structure/pipeline.rs:3690 β€” crates/xberg/src/pdf/structure/pipeline.rs:3690-3707 | crates/xberg/src/pdf/structure/pipeline.rs:3708-3726 β€” both copies are in the same file, so extract the 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–19 lines × 2) tools/generate_test_fixtures/src/generate_test_fixtures/diff_pairs.py:94 β€” tools/generate_test_fixtures/src/generate_test_fixtures/diff_pairs.py:94-112 | tools/generate_test_fixtures/src/generate_test_fixtures/diff_pairs.py:139-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. Read the line range as the matched WINDOW rather than a finished unit: at `tools/generate_test_fixtures/src/generate_test_fixtures/diff_pairs.py:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand β€” widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names β€” the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 Β· Code Duplication Β· Duplicated block (15–17 lines × 2) Β· Γ—2
  • Duplicated block (15–17 lines × 2) crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1459 β€” crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1459-1473 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:1081-1097 β€” 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 (15–17 lines × 2) crates/xberg-native-pdf/src/fonts/font_dict.rs:6103 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:6103-6117 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6167-6183 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (14–17 lines × 2) Β· Γ—2
  • Duplicated block (14–17 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5924 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5924-5937 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6583-6599 β€” both copies are in the same file, so extract the 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–17 lines × 2) crates/xberg-tesseract/src/page_iterator.rs:135 β€” crates/xberg-tesseract/src/page_iterator.rs:135-148 | crates/xberg-tesseract/src/result_iterator.rs:327-343 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (16 lines × 6) Β· Γ—2
  • Duplicated block (16 lines × 6) crates/xberg-native-pdf/src/fonts/font_dict.rs:3432 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:3432-3447 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3519-3534 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3606-3621 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3698-3713 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3769-3784 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3835-3850 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (16 lines × 6) crates/xberg-native-pdf/src/fonts/radical_forms.rs:87 β€” crates/xberg-native-pdf/src/fonts/radical_forms.rs:87-102 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:151-166 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:228-243 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:293-308 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:353-368 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:413-428 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (14–15 lines × 3) Β· Γ—2
  • Duplicated block (14–15 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs:130 β€” crates/xberg-native-pdf/src/document/extract_api.rs:130-143 | crates/xberg-native-pdf/src/document/extract_api.rs:749-763 | crates/xberg-native-pdf/src/document/extract_api.rs:1210-1223 β€” 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 (14–15 lines × 3) crates/xberg/src/rendering/djot.rs:352 β€” crates/xberg/src/rendering/djot.rs:352-365 | crates/xberg/src/rendering/markdown.rs:256-270 | crates/xberg/src/rendering/plain.rs:307-321 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from all 3 call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (15 lines × 3) Β· Γ—2
  • Duplicated block (15 lines × 3) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2099 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2099-2113 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2139-2153 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2168-2182 β€” 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 (15 lines × 3) crates/xberg/src/extraction/docx/table/mod.rs:263 β€” crates/xberg/src/extraction/docx/table/mod.rs:263-277 | crates/xberg/src/extraction/docx/table/mod.rs:437-451 | crates/xberg/src/extraction/docx/table/mod.rs:487-501 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (14–15 lines × 2) Β· Γ—2
  • Duplicated block (14–15 lines × 2) crates/xberg/src/extractors/docbook.rs:456 β€” crates/xberg/src/extractors/docbook.rs:456-469 | crates/xberg/src/extractors/docbook.rs:766-780 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (14–15 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1390 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1390-1403 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1552-1566 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (14 lines × 6) Β· Γ—2
  • Duplicated block (14 lines × 6) crates/xberg-native-pdf/src/fonts/encoding.rs:185 β€” crates/xberg-native-pdf/src/fonts/encoding.rs:185-198 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6056-6069 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6104-6117 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6170-6183 | crates/xberg-native-pdf/src/text/kangxi.rs:58-71 | crates/xberg-native-pdf/src/text/kangxi.rs:107-120 β€” before extracting anything, compare `crates/xberg-native-pdf/src/fonts/encoding.rs` and `crates/xberg-native-pdf/src/fonts/font_dict.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 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 (14 lines × 6) crates/xberg-native-pdf/src/fonts/radical_forms.rs:39 β€” crates/xberg-native-pdf/src/fonts/radical_forms.rs:39-52 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:109-122 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:184-197 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:249-262 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:314-327 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:374-387 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (14 lines × 4) Β· Γ—2
  • Duplicated block (14 lines × 4) crates/xberg-native-pdf/src/fonts/font_dict.rs:3363 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:3363-3376 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3450-3463 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3537-3550 | crates/xberg-native-pdf/src/fonts/font_dict.rs:3622-3635 β€” 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 (14 lines × 4) crates/xberg/src/extraction/docx/table/mod.rs:589 β€” crates/xberg/src/extraction/docx/table/mod.rs:589-602 | crates/xberg/src/extraction/docx/table/mod.rs:614-627 | crates/xberg/src/extraction/docx/table/mod.rs:662-675 | crates/xberg/src/extraction/docx/table/mod.rs:681-694 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (11–14 lines × 2) Β· Γ—2
  • Duplicated block (11–14 lines × 2) crates/xberg/src/extractors/latex/mod.rs:401 β€” crates/xberg/src/extractors/latex/mod.rs:401-411 | crates/xberg/src/extractors/latex/utilities.rs:491-504 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (11–14 lines × 2) tools/benchmark-harness/src/sizes.rs:149 β€” tools/benchmark-harness/src/sizes.rs:149-162 | tools/benchmark-harness/src/sizes.rs:204-214 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (12–13 lines × 3) Β· Γ—2
  • Duplicated block (12–13 lines × 3) crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:131 β€” crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_gb1.rs:131-142 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_japan1.rs:80-91 | crates/xberg-native-pdf/src/fonts/cid_mappings/adobe_korea1.rs:86-98 β€” 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 (12–13 lines × 3) crates/xberg/src/extractors/markdown.rs:804 β€” crates/xberg/src/extractors/markdown.rs:804-815 | crates/xberg/src/extractors/markdown.rs:899-911 | crates/xberg/src/extractors/markdown.rs:922-933 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (9–11 lines × 2) Β· Γ—2
  • Duplicated block (9–11 lines × 2) crates/xberg/src/extractors/latex/mod.rs:970 β€” crates/xberg/src/extractors/latex/mod.rs:970-980 | crates/xberg/src/extractors/latex/mod.rs:1053-1061 β€” both copies are in the same file, so extract the 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) tools/benchmark-harness/src/comparison/extraction_config.rs:451 β€” tools/benchmark-harness/src/comparison/extraction_config.rs:451-459 | tools/benchmark-harness/src/comparison/extraction_config.rs:463-473 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (9–10 lines × 3) Β· Γ—2
  • Duplicated block (9–10 lines × 3) crates/xberg/src/core/config/extraction/core.rs:809 β€” crates/xberg/src/core/config/extraction/core.rs:809-817 | crates/xberg/src/core/config/extraction/core.rs:819-828 | crates/xberg/src/core/config/extraction/core.rs:879-887 β€” 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 (9–10 lines × 3) crates/xberg/src/extractors/docbook.rs:265 β€” crates/xberg/src/extractors/docbook.rs:265-273 | crates/xberg/src/extractors/jats/elements.rs:38-47 | crates/xberg/src/extractors/jats/mod.rs:237-245 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (8–10 lines × 2) Β· Γ—2
  • Duplicated block (8–10 lines × 2) crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3457 β€” crates/xberg-native-pdf/src/structure/spatial_table_detector.rs:3457-3464 | crates/xberg-native-pdf/src/structure/table_extractor.rs:887-896 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
  • Duplicated block (8–10 lines × 2) tools/benchmark-harness/src/runner/execution.rs:293 β€” tools/benchmark-harness/src/runner/execution.rs:293-300 | tools/benchmark-harness/src/runner/execution.rs:476-485 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (6–9 lines × 2) Β· Γ—2
  • Duplicated block (6–9 lines × 2) crates/xberg-native-pdf/src/fonts/font_dict.rs:5921 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:5921-5929 | crates/xberg-native-pdf/src/fonts/font_dict.rs:5934-5939 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–9 lines × 2) crates/xberg/src/extractors/pdf/ocr/rendering.rs:709 β€” crates/xberg/src/extractors/pdf/ocr/rendering.rs:709-717 | crates/xberg/src/extractors/pdf/ocr/rendering.rs:828-833 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 11) Β· Γ—2
  • Duplicated block (8 lines × 11) crates/xberg/src/extraction/docx/math/collect.rs:137 β€” crates/xberg/src/extraction/docx/math/collect.rs:137-144 | crates/xberg/src/extraction/docx/math/collect.rs:174-181 | crates/xberg/src/extraction/docx/math/collect.rs:212-219 | crates/xberg/src/extraction/docx/math/elements.rs:321-328 | crates/xberg/src/extraction/docx/math/elements.rs:358-365 | crates/xberg/src/extraction/docx/math/elements.rs:427-434 | crates/xberg/src/extraction/docx/math/elements.rs:466-473 | crates/xberg/src/extraction/docx/math/elements.rs:506-513 | crates/xberg/src/extraction/docx/math/elements.rs:611-618 | crates/xberg/src/extraction/docx/math/elements.rs:695-702 | crates/xberg/src/extraction/docx/math/elements.rs:802-809 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 11) crates/xberg-pdfium-render/src/pdf/document/page/annotation/circle.rs:29 β€” crates/xberg-pdfium-render/src/pdf/document/page/annotation/circle.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/free_text.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/highlight.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/ink.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/link.rs:31-38 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/square.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/squiggly.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/stamp.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/strikeout.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/text.rs:29-36 | crates/xberg-pdfium-render/src/pdf/document/page/annotation/underline.rs:29-36 β€” 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 11 call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 5) Β· Γ—2
  • Duplicated block (8 lines × 5) crates/xberg/src/extractors/markdown.rs:309 β€” crates/xberg/src/extractors/markdown.rs:309-316 | crates/xberg/src/extractors/markdown.rs:339-346 | crates/xberg/src/extractors/markdown.rs:369-376 | crates/xberg/src/extractors/markdown.rs:399-406 | crates/xberg/src/extractors/markdown.rs:429-436 β€” all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 5) tools/benchmark-harness/scripts/docling_extract.py:265 β€” tools/benchmark-harness/scripts/docling_extract.py:265-272 | tools/benchmark-harness/scripts/markitdown_extract.py:98-105 | tools/benchmark-harness/scripts/mineru_extract.py:280-287 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:106-113 | tools/benchmark-harness/scripts/unstructured_extract.py:115-122 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/markitdown_extract.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 Β· Code Duplication Β· Duplicated block (6–8 lines × 2) Β· Γ—2
  • Duplicated block (6–8 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:1228 β€” crates/xberg-native-pdf/src/document/extract_api.rs:1228-1233 | crates/xberg-native-pdf/src/pipeline/reading_order/simple.rs:22-29 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6–8 lines × 2) crates/xberg/src/ocr/processor/mod.rs:52 β€” crates/xberg/src/ocr/processor/mod.rs:52-57 | crates/xberg/src/ocr/processor/mod.rs:86-93 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 4) Β· Γ—2
  • Duplicated block (7 lines × 4) crates/xberg-tesseract/src/api.rs:1509 β€” crates/xberg-tesseract/src/api.rs:1509-1515 | crates/xberg-tesseract/src/api.rs:1563-1569 | crates/xberg-tesseract/src/api.rs:1636-1642 | crates/xberg-tesseract/src/api.rs:1722-1728 β€” 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 (7 lines × 4) crates/xberg-native-pdf/src/extractors/forms.rs:220 β€” crates/xberg-native-pdf/src/extractors/forms.rs:220-226 | crates/xberg-native-pdf/src/extractors/page_labels.rs:148-154 | crates/xberg-native-pdf/src/extractors/xmp.rs:203-209 | crates/xberg-native-pdf/src/xfa/extractor.rs:135-141 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 4 times.
D4 Β· Code Duplication Β· Duplicated block (6 lines × 4) Β· Γ—2
  • Duplicated block (6 lines × 4) crates/xberg/src/extractors/iwork/keynote.rs:201 β€” crates/xberg/src/extractors/iwork/keynote.rs:201-206 | crates/xberg/src/extractors/iwork/numbers.rs:1332-1337 | crates/xberg/src/extractors/iwork/pages.rs:164-169 | crates/xberg/src/extractors/ppt.rs:78-83 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 4) crates/xberg/src/pdf/structure/classify.rs:381 β€” crates/xberg/src/pdf/structure/classify.rs:381-386 | crates/xberg/src/pdf/structure/classify.rs:398-404 | crates/xberg/src/pdf/structure/classify.rs:416-422 | crates/xberg/src/pdf/structure/layout_classify.rs:413-418 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/classify.rs` and `crates/xberg/src/pdf/structure/layout_classify.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (4–6 lines × 3) Β· Γ—2
  • Duplicated block (4–6 lines × 3) crates/xberg-native-pdf/src/rendering/resolution/color.rs:216 β€” crates/xberg-native-pdf/src/rendering/resolution/color.rs:216-221 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:278-283 | crates/xberg-native-pdf/src/rendering/resolution/color.rs:331-334 β€” 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 (4–6 lines × 3) crates/xberg/src/text/token_reduction/simd_text.rs:79 β€” crates/xberg/src/text/token_reduction/simd_text.rs:79-84 | crates/xberg/src/utils/quality/mod.rs:209-214 | tools/benchmark-harness/src/adapters/subprocess/support.rs:35-38 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 8) Β· Γ—2
  • Duplicated block (7 lines × 8) crates/xberg/src/plugins/embedding.rs:118 β€” crates/xberg/src/plugins/embedding.rs:118-124 | crates/xberg/src/plugins/embedding.rs:134-140 | crates/xberg/src/plugins/extractor/mod.rs:26-32 | crates/xberg/src/plugins/ocr.rs:578-585 | crates/xberg/src/plugins/renderer.rs:99-105 | crates/xberg/src/plugins/reranker.rs:117-123 | crates/xberg/src/plugins/tokenizer.rs:103-109 | crates/xberg/src/plugins/validator/mod.rs:14-21 β€” before extracting anything, compare `crates/xberg/src/plugins/ocr.rs` and `crates/xberg/src/plugins/renderer.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (7 lines × 8) crates/xberg/src/plugins/embedding.rs:162 β€” crates/xberg/src/plugins/embedding.rs:162-168 | crates/xberg/src/plugins/extractor/mod.rs:51-58 | crates/xberg/src/plugins/ocr.rs:641-648 | crates/xberg/src/plugins/processor/registry.rs:28-35 | crates/xberg/src/plugins/renderer.rs:125-131 | crates/xberg/src/plugins/reranker.rs:164-170 | crates/xberg/src/plugins/tokenizer.rs:147-153 | crates/xberg/src/plugins/validator/mod.rs:35-42 β€” before extracting anything, compare `crates/xberg/src/plugins/ocr.rs` and `crates/xberg/src/plugins/renderer.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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.
C1 Β· Data Protection Β· No data-protection/encryption Β· Γ—1
  • No data-protection/encryption β€” No data-protection or encryption usage (ASP.NET Data Protection, AES, column encryption, PBKDF2) was found β€” sensitive data at rest may be unprotected. If TDE/KMS/vault is delegated to infrastructure, ignore.
D1 Β· Cyclomatic Complexity Β· MarkdownExtractor Β· Γ—1
  • MarkdownExtractor::build_internal_document_with_jsx (cyclomatic 254) crates/xberg/src/extractors/markdown.rs:127 β€” MarkdownExtractor::build_internal_document_with_jsx has cyclomatic complexity 254 (threshold 15). Of this number, 253 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· DjotExtractor Β· Γ—1
  • DjotExtractor::build_internal_document (cyclomatic 172) crates/xberg/src/extractors/djot_format/extractor.rs:37 β€” DjotExtractor::build_internal_document has cyclomatic complexity 172 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· PdfExtractor Β· Γ—1
  • PdfExtractor::extract_core_native (cyclomatic 121) crates/xberg/src/extractors/pdf/mod.rs:2250 β€” PdfExtractor::extract_core_native has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· TypstExtractor Β· Γ—1
  • TypstExtractor::build_internal_document (cyclomatic 85) crates/xberg/src/extractors/typst.rs:87 β€” TypstExtractor::build_internal_document has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· EpubExtractor Β· Γ—1
  • EpubExtractor::build_internal_document (cyclomatic 65) crates/xberg/src/extractors/epub/mod.rs:221 β€” EpubExtractor::build_internal_document has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· DocxExtractor Β· Γ—1
  • DocxExtractor::extract_content (cyclomatic 53) crates/xberg/src/extractors/docx.rs:914 β€” DocxExtractor::extract_content has cyclomatic complexity 53 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· XfaParser Β· Γ—1
  • XfaParser::parse_template (cyclomatic 43) crates/xberg-native-pdf/src/xfa/parser.rs:309 β€” XfaParser::parse_template has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· xberg_cli Β· Γ—1
  • xberg_cli::main (cyclomatic 40) crates/xberg-cli/src/main.rs:836 β€” xberg_cli::main has cyclomatic complexity 40 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 Β· Cyclomatic Complexity Β· RtfExtractor Β· Γ—1
  • RtfExtractor::build_internal_document (cyclomatic 39) crates/xberg/src/extractors/rtf/mod.rs:126 β€” RtfExtractor::build_internal_document has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· RedactionPass Β· Γ—1
  • RedactionPass::redact_format_metadata (cyclomatic 36) crates/xberg/src/text/redaction/engine.rs:774 β€” RedactionPass::redact_format_metadata has cyclomatic complexity 36 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 Β· Cyclomatic Complexity Β· HtmlWalker Β· Γ—1
  • HtmlWalker::handle_close_tag (cyclomatic 33) crates/xberg/src/extraction/html/structure/tag_handlers.rs:329 β€” HtmlWalker::handle_close_tag has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: HtmlWalker::handle_open_tag (cyclomatic 36) is higher and carries no row of its own β€” it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 Β· Cyclomatic Complexity Β· Paragraph Β· Γ—1
  • Paragraph::runs_to_markdown (cyclomatic 29) crates/xberg/src/extraction/docx/parser.rs:885 β€” Paragraph::runs_to_markdown has cyclomatic complexity 29 (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.
D1 Β· Cyclomatic Complexity Β· Run Β· Γ—1
  • Run::to_markdown (cyclomatic 28) crates/xberg/src/extraction/docx/parser.rs:1059 β€” Run::to_markdown has cyclomatic complexity 28 (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.
D1 Β· Cyclomatic Complexity Β· Table Β· Γ—1
  • Table::render_text (cyclomatic 28) crates/xberg-native-pdf/src/structure/table_extractor.rs:143 β€” Table::render_text has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· build_corpus.stage_gate (cyclomatic 28) Β· Γ—1
  • build_corpus.stage_gate (cyclomatic 28) tools/benchmark-harness/scripts/build_corpus.py:332 β€” build_corpus.stage_gate has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· SlanetModel Β· Γ—1
  • SlanetModel::recognize (cyclomatic 26) crates/xberg/src/layout/models/slanet.rs:186 β€” SlanetModel::recognize has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· JatsExtractor Β· Γ—1
  • JatsExtractor::extract_content (cyclomatic 25) crates/xberg/src/extractors/jats/mod.rs:582 β€” JatsExtractor::extract_content has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· EmailExtractor Β· Γ—1
  • EmailExtractor::build_internal_document (cyclomatic 23) crates/xberg/src/extractors/email.rs:58 β€” EmailExtractor::build_internal_document 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.
D1 Β· Cyclomatic Complexity Β· OdpExtractor Β· Γ—1
  • OdpExtractor::extract_content (cyclomatic 23) crates/xberg/src/extractors/odp.rs:426 β€” OdpExtractor::extract_content 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.
D1 Β· Cyclomatic Complexity Β· OdtExtractor Β· Γ—1
  • OdtExtractor::extract_content (cyclomatic 23) crates/xberg/src/extractors/odt.rs:1635 β€” OdtExtractor::extract_content 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.
D1 Β· Cyclomatic Complexity Β· XbergMcp Β· Γ—1
  • XbergMcp::cache_warm (cyclomatic 23) crates/xberg/src/mcp/server.rs:476 β€” XbergMcp::cache_warm 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.
D1 Β· Cyclomatic Complexity Β· PdfDestinationViewSettings Β· Γ—1
  • PdfDestinationViewSettings::view_settings_for_mode (cyclomatic 22) crates/xberg-pdfium-render/src/pdf/destination.rs:135 β€” PdfDestinationViewSettings::view_settings_for_mode has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform β€” the same kind of value, with no behaviour of its own β€” a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 Β· Cyclomatic Complexity Β· PptxExtractor Β· Γ—1
  • PptxExtractor::push_markdown_content (cyclomatic 21) crates/xberg/src/extractors/pptx.rs:236 β€” PptxExtractor::push_markdown_content has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· TextWalk Β· Γ—1
  • TextWalk::open (cyclomatic 20) crates/xberg/src/extractors/epub/content.rs:786 β€” TextWalk::open has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· classic_ocr_cache_acceptance.validate_manifest (cyclomatic 20) Β· Γ—1
  • classic_ocr_cache_acceptance.validate_manifest (cyclomatic 20) scripts/classic_ocr_cache_acceptance.py:166 β€” classic_ocr_cache_acceptance.validate_manifest has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· import_omnidocbench.annotation_to_markdown (cyclomatic 20) Β· Γ—1
  • import_omnidocbench.annotation_to_markdown (cyclomatic 20) tools/benchmark-harness/scripts/import_omnidocbench.py:88 β€” import_omnidocbench.annotation_to_markdown has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· demo.html.processFile (cyclomatic 20) Β· Γ—1
  • demo.html.processFile (cyclomatic 20) docs-site/public/demo.html:728 β€” demo.html.processFile has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· AsciiDocParser Β· Γ—1
  • AsciiDocParser::parse_block (cyclomatic 19) crates/xberg/src/extractors/asciidoc.rs:213 β€” AsciiDocParser::parse_block has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· docling_extract.main (cyclomatic 19) Β· Γ—1
  • docling_extract.main (cyclomatic 19) tools/benchmark-harness/scripts/docling_extract.py:292 β€” docling_extract.main has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· Slide Β· Γ—1
  • Slide::to_internal_elements (cyclomatic 18) crates/xberg/src/extraction/pptx/elements.rs:414 β€” Slide::to_internal_elements has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· ImageExtractor Β· Γ—1
  • ImageExtractor::extract_with_ocr (cyclomatic 18) crates/xberg/src/extractors/image.rs:2846 β€” ImageExtractor::extract_with_ocr has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· sync_supported_counts.tracked_text_files (cyclomatic 18) Β· Γ—1
  • sync_supported_counts.tracked_text_files (cyclomatic 18) scripts/sync_supported_counts.py:405 β€” sync_supported_counts.tracked_text_files has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· readerMapping.buildMetadata (cyclomatic 18) Β· Γ—1
  • readerMapping.buildMetadata (cyclomatic 18) integrations/node/llamaindex-xberg/src/readerMapping.ts:341 β€” readerMapping.buildMetadata has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 Β· Cyclomatic Complexity Β· RstReferences Β· Γ—1
  • RstReferences::collect (cyclomatic 17) crates/xberg/src/extractors/rst.rs:138 β€” RstReferences::collect has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· WordBoundaryDetector Β· Γ—1
  • WordBoundaryDetector::is_word_boundary (cyclomatic 17) crates/xberg-native-pdf/src/text/word_boundary.rs:419 β€” WordBoundaryDetector::is_word_boundary has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· GenericCache Β· Γ—1
  • GenericCache::is_valid (cyclomatic 16) crates/xberg/src/cache/core.rs:146 β€” GenericCache::is_valid has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· LatexParser Β· Γ—1
  • LatexParser::process_environments (cyclomatic 16) crates/xberg/src/extractors/latex/parser.rs:109 β€” LatexParser::process_environments has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· TextParser Β· Γ—1
  • TextParser::handle_skipped_control_word (cyclomatic 16) crates/xberg/src/extractors/rtf/parser/text_extract.rs:789 β€” TextParser::handle_skipped_control_word has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 Β· Cyclomatic Complexity Β· TjBuffer Β· Γ—1
  • TjBuffer::append (cyclomatic 16) crates/xberg-native-pdf/src/extractors/text/mod.rs:1971 β€” TjBuffer::append has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· sync_integration_versions.main (cyclomatic 16) Β· Γ—1
  • sync_integration_versions.main (cyclomatic 16) scripts/sync_integration_versions.py:231 β€” sync_integration_versions.main has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 Β· Cyclomatic Complexity Β· mineru_extract.main (cyclomatic 16) Β· Γ—1
  • mineru_extract.main (cyclomatic 16) tools/benchmark-harness/scripts/mineru_extract.py:307 β€” mineru_extract.main has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· MarkdownExtractor Β· Γ—1
  • MarkdownExtractor::build_internal_document_with_jsx (cognitive 466) crates/xberg/src/extractors/markdown.rs:127 β€” MarkdownExtractor::build_internal_document_with_jsx has cognitive complexity 466 (threshold 15). Drivers by points: if/else 172 (414 pts), boolean chains 29, match/switch 7 (21 pts), loops 2 (nesting depth added 256). Of this number, 465 points are the body's own statements and 1 belongs 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.
D2 Β· Cognitive Complexity Β· DjotExtractor Β· Γ—1
  • DjotExtractor::build_internal_document (cognitive 300) crates/xberg/src/extractors/djot_format/extractor.rs:37 β€” DjotExtractor::build_internal_document has cognitive complexity 300 (threshold 15). Drivers by points: if/else 125 (288 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (nesting depth added 166). To reduce it, flatten the nesting: this score is depth rather than breadth β€” most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 Β· Cognitive Complexity Β· PdfExtractor Β· Γ—1
  • PdfExtractor::extract_core_native (cognitive 226) crates/xberg/src/extractors/pdf/mod.rs:2250 β€” PdfExtractor::extract_core_native has cognitive complexity 226 (threshold 15). Drivers by points: if/else 79 (150 pts), boolean chains 27, loops 14 (26 pts), match/switch 8 (23 pts) (nesting depth added 98). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· EpubExtractor Β· Γ—1
  • EpubExtractor::build_internal_document (cognitive 106) crates/xberg/src/extractors/epub/mod.rs:221 β€” EpubExtractor::build_internal_document has cognitive complexity 106 (threshold 15). Drivers by points: if/else 29 (83 pts), match/switch 4 (10 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· RtfExtractor Β· Γ—1
  • RtfExtractor::build_internal_document (cognitive 86) crates/xberg/src/extractors/rtf/mod.rs:126 β€” RtfExtractor::build_internal_document has cognitive complexity 86 (threshold 15). Drivers by points: if/else 21 (42 pts), loops 13 (39 pts), boolean chains 5 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· DocxExtractor Β· Γ—1
  • DocxExtractor::extract_content (cognitive 82) crates/xberg/src/extractors/docx.rs:914 β€” DocxExtractor::extract_content has cognitive complexity 82 (threshold 15). Drivers by points: if/else 45 (58 pts), loops 6 (16 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 Β· Cognitive Complexity Β· Paragraph Β· Γ—1
  • Paragraph::runs_to_markdown (cognitive 71) crates/xberg/src/extraction/docx/parser.rs:885 β€” Paragraph::runs_to_markdown has cognitive complexity 71 (threshold 15). Drivers by points: if/else 20 (57 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 42). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes β€” or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 Β· Cognitive Complexity Β· build_corpus.stage_gate (cognitive 44) Β· Γ—1
  • build_corpus.stage_gate (cognitive 44) tools/benchmark-harness/scripts/build_corpus.py:332 β€” build_corpus.stage_gate has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 9, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· SlanetModel Β· Γ—1
  • SlanetModel::recognize (cognitive 42) crates/xberg/src/layout/models/slanet.rs:186 β€” SlanetModel::recognize has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 5 (11 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· xberg_cli Β· Γ—1
  • xberg_cli::main (cognitive 40) crates/xberg-cli/src/main.rs:836 β€” xberg_cli::main has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (23 pts), match/switch 7 (13 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· Run Β· Γ—1
  • Run::to_markdown (cognitive 34) crates/xberg/src/extraction/docx/parser.rs:1059 β€” Run::to_markdown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 28 (30 pts), boolean chains 4 (nesting depth added 2). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes β€” or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 Β· Cognitive Complexity Β· TextWalk Β· Γ—1
  • TextWalk::open (cognitive 33) crates/xberg/src/extractors/epub/content.rs:786 β€” TextWalk::open has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 3, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· RstReferences Β· Γ—1
  • RstReferences::collect (cognitive 33) crates/xberg/src/extractors/rst.rs:138 β€” RstReferences::collect has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· sync_supported_counts.tracked_text_files (cognitive 33) Β· Γ—1
  • sync_supported_counts.tracked_text_files (cognitive 33) scripts/sync_supported_counts.py:405 β€” sync_supported_counts.tracked_text_files has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 4 (8 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· GenericCache Β· Γ—1
  • GenericCache::is_valid (cognitive 32) crates/xberg/src/cache/core.rs:146 β€” GenericCache::is_valid has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 3 (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.
D2 Β· Cognitive Complexity Β· TjBuffer Β· Γ—1
  • TjBuffer::append (cognitive 32) crates/xberg-native-pdf/src/extractors/text/mod.rs:1971 β€” TjBuffer::append has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· EmailExtractor Β· Γ—1
  • EmailExtractor::build_internal_document (cognitive 31) crates/xberg/src/extractors/email.rs:58 β€” EmailExtractor::build_internal_document has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19 (24 pts), loops 4 (7 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 Β· Cognitive Complexity Β· XbergMcp Β· Γ—1
  • XbergMcp::cache_warm (cognitive 31) crates/xberg/src/mcp/server.rs:476 β€” XbergMcp::cache_warm has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 7, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 Β· Cognitive Complexity Β· ColorResolver Β· Γ—1
  • ColorResolver::resolve_iccbased (cognitive 31) crates/xberg-native-pdf/src/rendering/resolution/color.rs:175 β€” ColorResolver::resolve_iccbased has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 3, match/switch 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· JatsExtractor Β· Γ—1
  • JatsExtractor::extract_content (cognitive 29) crates/xberg/src/extractors/jats/mod.rs:582 β€” JatsExtractor::extract_content has cognitive complexity 29 (threshold 15). Drivers by points: if/else 23, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· corpus_cache_manifest.verify_archive (cognitive 29) Β· Γ—1
  • corpus_cache_manifest.verify_archive (cognitive 29) tools/benchmark-harness/scripts/corpus_cache_manifest.py:134 β€” corpus_cache_manifest.verify_archive 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.
D2 Β· Cognitive Complexity Β· PolicyMode Β· Γ—1
  • PolicyMode::default_decision (cognitive 26) crates/xberg-native-pdf/src/crypto/policy.rs:380 β€” PolicyMode::default_decision has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 Β· Cognitive Complexity Β· sync_integration_versions.transform (cognitive 26) Β· Γ—1
  • sync_integration_versions.transform (cognitive 26) scripts/sync_integration_versions.py:170 β€” sync_integration_versions.transform has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· OdpExtractor Β· Γ—1
  • OdpExtractor::extract_content (cognitive 25) crates/xberg/src/extractors/odp.rs:426 β€” OdpExtractor::extract_content has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (23 pts), match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 Β· Cognitive Complexity Β· OdtExtractor Β· Γ—1
  • OdtExtractor::extract_content (cognitive 25) crates/xberg/src/extractors/odt.rs:1635 β€” OdtExtractor::extract_content has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (23 pts), match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 Β· Cognitive Complexity Β· check-alef-readme-paths.build_refs (cognitive 25) Β· Γ—1
  • check-alef-readme-paths.build_refs (cognitive 25) scripts/ci/check-alef-readme-paths.py:130 β€” check-alef-readme-paths.build_refs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 5 (10 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· sync_integration_versions.main (cognitive 25) Β· Γ—1
  • sync_integration_versions.main (cognitive 25) scripts/sync_integration_versions.py:231 β€” sync_integration_versions.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 6 (11 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· demo.html.processFile (cognitive 25) Β· Γ—1
  • demo.html.processFile (cognitive 25) docs-site/public/demo.html:728 β€” demo.html.processFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (nesting depth added 7). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· ContentBuilder Β· Γ—1
  • ContentBuilder::add_table (cognitive 24) crates/xberg/src/extraction/pptx/content_builder.rs:128 β€” ContentBuilder::add_table has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (17 pts), if/else 5 (7 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 Β· Cognitive Complexity Β· DeepseekOCRModel Β· Γ—1
  • DeepseekOCRModel::forward (cognitive 24) crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1329 β€” DeepseekOCRModel::forward has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 3 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· SlideIterator Β· Γ—1
  • SlideIterator::resolve_graphic_frame_text (cognitive 23) crates/xberg/src/extraction/pptx/container.rs:274 β€” SlideIterator::resolve_graphic_frame_text has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 5 (16 pts), if/else 2 (6 pts), loops 1 (nesting depth added 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 Β· Cognitive Complexity Β· Layouter Β· Γ—1
  • Layouter::draw_line (cognitive 23) crates/xberg/src/rendering/pdf/layout.rs:612 β€” Layouter::draw_line has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (7 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.
D2 Β· Cognitive Complexity Β· build_structural_sidecar._parse_list_block (cognitive 23) Β· Γ—1
  • build_structural_sidecar._parse_list_block (cognitive 23) tools/benchmark-harness/scripts/build_structural_sidecar.py:198 β€” build_structural_sidecar._parse_list_block has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (6 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· import_omnidocbench.annotation_to_markdown (cognitive 23) Β· Γ—1
  • import_omnidocbench.annotation_to_markdown (cognitive 23) tools/benchmark-harness/scripts/import_omnidocbench.py:88 β€” import_omnidocbench.annotation_to_markdown has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6 (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.
D2 Β· Cognitive Complexity Β· score_gt_lines.main (cognitive 23) Β· Γ—1
  • score_gt_lines.main (cognitive 23) tools/ocr-measure/score_gt_lines.py:156 β€” score_gt_lines.main has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 7 (10 pts), boolean chains 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· xberg_candle_ocr Β· Γ—1
  • xberg_candle_ocr::models::deepseek_ocr::utils::masked_scatter_dim0 (cognitive 22) crates/xberg-candle-ocr/src/models/deepseek_ocr/utils.rs:176 β€” xberg_candle_ocr::models::deepseek_ocr::utils::masked_scatter_dim0 has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 Β· Cognitive Complexity Β· downloader._safe_extract (cognitive 22) Β· Γ—1
  • downloader._safe_extract (cognitive 22) cli-proxy/pypi/xberg_cli/downloader.py:184 β€” downloader._safe_extract has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· vendor-xberg-core.format_dependency (cognitive 22) Β· Γ—1
  • vendor-xberg-core.format_dependency (cognitive 22) scripts/ci/ruby/vendor-xberg-core.py:54 β€” vendor-xberg-core.format_dependency has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (22 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· classic_ocr_cache_acceptance.validate_manifest (cognitive 22) Β· Γ—1
  • classic_ocr_cache_acceptance.validate_manifest (cognitive 22) scripts/classic_ocr_cache_acceptance.py:166 β€” classic_ocr_cache_acceptance.validate_manifest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, 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.
D2 Β· Cognitive Complexity Β· ExcelExtractor Β· Γ—1
  • ExcelExtractor::build_internal_document (cognitive 21) crates/xberg/src/extractors/excel.rs:198 β€” ExcelExtractor::build_internal_document has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· NativeTextStats Β· Γ—1
  • NativeTextStats::compute (cognitive 21) crates/xberg/src/extractors/pdf/ocr/scoring.rs:134 β€” NativeTextStats::compute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· EncodedInput Β· Γ—1
  • EncodedInput::from (cognitive 21) crates/xberg-gliner/src/preprocess.rs:116 β€” EncodedInput::from has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 6 (10 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· TesseractAPI Β· Γ—1
  • TesseractAPI::get_textlines (cognitive 21) crates/xberg-tesseract/src/api.rs:1609 β€” TesseractAPI::get_textlines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· plausibility_calibrate.main (cognitive 21) Β· Γ—1
  • plausibility_calibrate.main (cognitive 21) tools/benchmark-harness/scripts/plausibility_calibrate.py:212 β€” plausibility_calibrate.main has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 5 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· ScriptIndex Β· Γ—1
  • ScriptIndex::read_page (cognitive 20) crates/xberg/src/extraction/doc/chpx.rs:85 β€” ScriptIndex::read_page has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· CommentState Β· Γ—1
  • CommentState::strip_new_comment (cognitive 20) crates/xberg/src/extractors/latex/utilities.rs:373 β€” CommentState::strip_new_comment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, match/switch 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· ZipBombValidator Β· Γ—1
  • ZipBombValidator::validate (cognitive 20) crates/xberg/src/extractors/security.rs:362 β€” ZipBombValidator::validate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· PdfRenderConfig Β· Γ—1
  • PdfRenderConfig::compute_output_dimensions (cognitive 20) crates/xberg-pdfium-render/src/pdf/document/page/render_config.rs:664 β€” PdfRenderConfig::compute_output_dimensions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· Pdfium Β· Γ—1
  • Pdfium::new_with_config (cognitive 20) crates/xberg-pdfium-render/src/pdfium.rs:204 β€” Pdfium::new_with_config has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· build_structural_sidecar.parse_markdown (cognitive 20) Β· Γ—1
  • build_structural_sidecar.parse_markdown (cognitive 20) tools/benchmark-harness/scripts/build_structural_sidecar.py:101 β€” build_structural_sidecar.parse_markdown has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· corpus_cache_manifest._reference_documents (cognitive 20) Β· Γ—1
  • corpus_cache_manifest._reference_documents (cognitive 20) tools/benchmark-harness/scripts/corpus_cache_manifest.py:22 β€” corpus_cache_manifest._reference_documents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· Element Β· Γ—1
  • Element::sections (cognitive 19) crates/xberg/src/chunking/text_splitter/splitter/markdown.rs:206 β€” Element::sections has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (12 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· CodeExtractor Β· Γ—1
  • CodeExtractor::extract_with_language (cognitive 19) crates/xberg/src/extractors/code.rs:163 β€” CodeExtractor::extract_with_language has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (3 pts), 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.
D2 Β· Cognitive Complexity Β· ImageExtractor Β· Γ—1
  • ImageExtractor::extract_with_ocr (cognitive 19) crates/xberg/src/extractors/image.rs:2846 β€” ImageExtractor::extract_with_ocr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, match/switch 3 (4 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· build_corpus.stage_curate (cognitive 19) Β· Γ—1
  • build_corpus.stage_curate (cognitive 19) tools/benchmark-harness/scripts/build_corpus.py:467 β€” build_corpus.stage_curate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 6 (7 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· SMaskTransfer Β· Γ—1
  • SMaskTransfer::eval (cognitive 18) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7538 β€” SMaskTransfer::eval has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 Β· Cognitive Complexity Β· PdfDestinationViewSettings Β· Γ—1
  • PdfDestinationViewSettings::view_settings_for_mode (cognitive 18) crates/xberg-pdfium-render/src/pdf/destination.rs:135 β€” PdfDestinationViewSettings::view_settings_for_mode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 5 (6 pts) (nesting depth added 5). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 Β· Cognitive Complexity Β· check-binding-field-coverage.extract_fields (cognitive 18) Β· Γ—1
  • check-binding-field-coverage.extract_fields (cognitive 18) scripts/ci/check-binding-field-coverage.py:140 β€” check-binding-field-coverage.extract_fields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· sync_public_skills.validate_skills (cognitive 18) Β· Γ—1
  • sync_public_skills.validate_skills (cognitive 18) scripts/sync_public_skills.py:43 β€” sync_public_skills.validate_skills has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· WpdWalker Β· Γ—1
  • WpdWalker::handle_table_event (cognitive 17) crates/xberg/src/extractors/wordperfect.rs:555 β€” WpdWalker::handle_table_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction β€” a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full β€” so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 Β· Cognitive Complexity Β· Yake Β· Γ—1
  • Yake::ngram_selection (cognitive 17) crates/xberg/src/keywords/yake/mod.rs:339 β€” Yake::ngram_selection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· DocumentStructure Β· Γ—1
  • DocumentStructure::validate (cognitive 17) crates/xberg/src/types/document_structure.rs:887 β€” DocumentStructure::validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· xberg_gliner Β· Γ—1
  • xberg_gliner::candle::decode::collect_candidates_for_start (cognitive 17) crates/xberg-gliner/src/candle/decode.rs:115 β€” xberg_gliner::candle::decode::collect_candidates_for_start has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· PageLabelExtractor Β· Γ—1
  • PageLabelExtractor::parse_number_tree (cognitive 17) crates/xberg-native-pdf/src/extractors/page_labels.rs:220 β€” PageLabelExtractor::parse_number_tree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· WordBoundaryDetector Β· Γ—1
  • WordBoundaryDetector::is_word_boundary (cognitive 17) crates/xberg-native-pdf/src/text/word_boundary.rs:419 β€” WordBoundaryDetector::is_word_boundary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· vendor-xberg-core._clean_build_artifacts (cognitive 17) Β· Γ—1
  • vendor-xberg-core._clean_build_artifacts (cognitive 17) scripts/ci/ruby/vendor-xberg-core.py:275 β€” vendor-xberg-core._clean_build_artifacts has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 2 (6 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 Β· Cognitive Complexity Β· docling_extract.main (cognitive 17) Β· Γ—1
  • docling_extract.main (cognitive 17) tools/benchmark-harness/scripts/docling_extract.py:292 β€” docling_extract.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2, boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· readerMapping.buildMetadata (cognitive 17) Β· Γ—1
  • readerMapping.buildMetadata (cognitive 17) integrations/node/llamaindex-xberg/src/readerMapping.ts:341 β€” readerMapping.buildMetadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth β€” many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 Β· Cognitive Complexity Β· MdxExtractor Β· Γ—1
  • MdxExtractor::strip_mdx_syntax_collecting (cognitive 16) crates/xberg/src/extractors/mdx.rs:73 β€” MdxExtractor::strip_mdx_syntax_collecting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· BoundedObjectCache Β· Γ—1
  • BoundedObjectCache::insert (cognitive 16) crates/xberg-native-pdf/src/document/mod.rs:325 β€” BoundedObjectCache::insert has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· PathExtractor Β· Γ—1
  • PathExtractor::resolve_xobject_ref (cognitive 16) crates/xberg-native-pdf/src/extractors/paths.rs:291 β€” PathExtractor::resolve_xobject_ref has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· DocumentProperties Β· Γ—1
  • DocumentProperties::detect_column_count (cognitive 16) crates/xberg-native-pdf/src/layout/document_analyzer.rs:224 β€” DocumentProperties::detect_column_count has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· CitationDetector Β· Γ—1
  • CitationDetector::detect_numeric_citations (cognitive 16) crates/xberg-native-pdf/src/pipeline/text_processing/citations.rs:110 β€” CitationDetector::detect_numeric_citations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· verify_pi_package.verify_archive (cognitive 16) Β· Γ—1
  • verify_pi_package.verify_archive (cognitive 16) scripts/verify_pi_package.py:10 β€” verify_pi_package.verify_archive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth β€” checks laid out side by side rather than stacked β€” so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 Β· Cognitive Complexity Β· corpus_cache_manifest.verify_cache (cognitive 16) Β· Γ—1
  • corpus_cache_manifest.verify_cache (cognitive 16) tools/benchmark-harness/scripts/corpus_cache_manifest.py:94 β€” corpus_cache_manifest.verify_cache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· import_omnidocbench.page_to_markdown (cognitive 16) Β· Γ—1
  • import_omnidocbench.page_to_markdown (cognitive 16) tools/benchmark-harness/scripts/import_omnidocbench.py:134 β€” import_omnidocbench.page_to_markdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· import_omnidocbench.strip_markdown_to_text (cognitive 16) Β· Γ—1
  • import_omnidocbench.strip_markdown_to_text (cognitive 16) tools/benchmark-harness/scripts/import_omnidocbench.py:178 β€” import_omnidocbench.strip_markdown_to_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
D2 Β· Cognitive Complexity Β· markitdown_extract.main (cognitive 16) Β· Γ—1
  • markitdown_extract.main (cognitive 16) tools/benchmark-harness/scripts/markitdown_extract.py:125 β€” markitdown_extract.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· mineru_extract.main (cognitive 16) Β· Γ—1
  • mineru_extract.main (cognitive 16) tools/benchmark-harness/scripts/mineru_extract.py:307 β€” mineru_extract.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 Β· Cognitive Complexity Β· pymupdf4llm_extract.main (cognitive 16) Β· Γ—1
  • pymupdf4llm_extract.main (cognitive 16) tools/benchmark-harness/scripts/pymupdf4llm_extract.py:133 β€” pymupdf4llm_extract.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D30 Β· Dependency Vulnerabilities Β· Medium advisory (unmaintained) Β· Γ—1
  • REDACTED
D36 Β· Supply-chain Provenance & Signing Β· REDACTED Β· Γ—1
  • REDACTED
D36 Β· Supply-chain Provenance & Signing Β· REDACTED Β· Γ—1
  • REDACTED
D36 Β· Supply-chain Provenance & Signing Β· REDACTED Β· Γ—1
  • REDACTED
D4 Β· Code Duplication Β· Near-duplicate member family (6 members, 30 shared lines) Β· Γ—1
  • Near-duplicate member family (6 members, 30 shared lines) crates/xberg-native-pdf/src/fonts/radical_forms.rs:38 β€” crates/xberg-native-pdf/src/fonts/radical_forms.rs:38-102 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:108-166 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:183-243 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:248-308 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:313-368 | crates/xberg-native-pdf/src/fonts/radical_forms.rs:373-428 β€” These 6 members are variants of one another: a block of 30 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them 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 Β· Near-duplicate member pair (93 shared lines) Β· Γ—1
  • Near-duplicate member pair (93 shared lines) crates/xberg/src/core/pipeline/mod.rs:453 β€” crates/xberg/src/core/pipeline/mod.rs:453-753 | crates/xberg/src/core/pipeline/mod.rs:791-927 β€” These two members are variants of one another: 93 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (87 shared lines) Β· Γ—1
  • Near-duplicate member pair (87 shared lines) crates/xberg/src/ocr/tesseract_backend.rs:409 β€” crates/xberg/src/ocr/tesseract_backend.rs:409-505 | crates/xberg/src/ocr/tesseract_backend.rs:507-604 β€” These two members are variants of one another: 87 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (66 shared lines) Β· Γ—1
  • Near-duplicate member pair (66 shared lines) crates/xberg/src/extractors/docbook.rs:870 β€” crates/xberg/src/extractors/docbook.rs:870-1042 | crates/xberg/src/extractors/docbook.rs:1129-1344 β€” These two members are variants of one another: 66 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (54 shared lines) Β· Γ—1
  • Near-duplicate member pair (54 shared lines) crates/xberg/src/pdf/structure/pipeline.rs:5999 β€” crates/xberg/src/pdf/structure/pipeline.rs:5999-6082 | crates/xberg/src/pdf/structure/pipeline.rs:6088-6147 β€” These two members are variants of one another: 54 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (48 shared lines) Β· Γ—1
  • Near-duplicate member pair (48 shared lines) crates/xberg/src/extraction/docx/table/mod.rs:582 β€” crates/xberg/src/extraction/docx/table/mod.rs:582-652 | crates/xberg/src/extraction/docx/table/mod.rs:655-713 β€” These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (47 shared lines) Β· Γ—1
  • Near-duplicate member pair (47 shared lines) crates/xberg/src/extractors/docbook.rs:1129 β€” crates/xberg/src/extractors/docbook.rs:1129-1344 | crates/xberg/src/extractors/jats/mod.rs:62-208 β€” These two members are variants of one another: 47 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (43 shared lines) Β· Γ—1
  • Near-duplicate member pair (43 shared lines) crates/xberg-native-pdf/src/document/tables.rs:62 β€” crates/xberg-native-pdf/src/document/tables.rs:62-156 | crates/xberg-native-pdf/src/document/tables.rs:158-389 β€” These two members are variants of one another: 43 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (36 shared lines) Β· Γ—1
  • Near-duplicate member pair (36 shared lines) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3251 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:3251-3350 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:3369-3484 β€” These two members are variants of one another: 36 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (35 shared lines) Β· Γ—1
  • Near-duplicate member pair (35 shared lines) crates/xberg/src/pdf/structure/adapters.rs:1466 β€” crates/xberg/src/pdf/structure/adapters.rs:1466-1628 | crates/xberg/src/pdf/structure/pipeline.rs:1233-1302 β€” These two members are variants of one another: 35 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (23 shared lines) Β· Γ—1
  • Near-duplicate member pair (23 shared lines) crates/xberg/src/extractors/docx.rs:655 β€” crates/xberg/src/extractors/docx.rs:655-742 | crates/xberg/src/extractors/wordperfect.rs:631-681 β€” These two members are variants of one another: 23 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Near-duplicate member pair (19 shared lines) Β· Γ—1
  • Near-duplicate member pair (19 shared lines) crates/xberg-native-pdf/src/extractors/images.rs:2817 β€” crates/xberg-native-pdf/src/extractors/images.rs:2817-2858 | crates/xberg-native-pdf/src/extractors/images.rs:2867-2903 β€” These two members are variants of one another: 19 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain β€” factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 Β· Code Duplication Β· Edited copy of a member (37 corresponding lines) Β· Γ—1
  • Edited copy of a member (37 corresponding lines) crates/xberg/src/extraction/doc/metadata.rs:111 β€” crates/xberg/src/extraction/doc/metadata.rs:111-147 | crates/xberg/src/extraction/ppt/mod.rs:1508-1544 β€” 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 (31 corresponding lines) Β· Γ—1
  • Edited copy of a member (31 corresponding lines) crates/xberg-native-pdf/src/fonts/encoding.rs:289 β€” crates/xberg-native-pdf/src/fonts/encoding.rs:289-324 | crates/xberg/src/extractors/rtf/encoding.rs:46-79 β€” 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 Β· Members sharing a duplicated core (17 members, 50+ identical tokens) Β· Γ—1
  • Members sharing a duplicated core (17 members, 50+ identical tokens) crates/xberg/src/extraction/docx/math/collect.rs:135 β€” crates/xberg/src/extraction/docx/math/collect.rs:135-169 | crates/xberg/src/extraction/docx/math/collect.rs:172-206 | crates/xberg/src/extraction/docx/math/collect.rs:209-245 | crates/xberg/src/extraction/docx/math/elements.rs:4-40 | crates/xberg/src/extraction/docx/math/elements.rs:75-112 | crates/xberg/src/extraction/docx/math/elements.rs:138-185 | crates/xberg/src/extraction/docx/math/elements.rs:230-273 | crates/xberg/src/extraction/docx/math/elements.rs:319-353 | crates/xberg/src/extraction/docx/math/elements.rs:356-390 | crates/xberg/src/extraction/docx/math/elements.rs:426-458 | crates/xberg/src/extraction/docx/math/elements.rs:464-498 | crates/xberg/src/extraction/docx/math/elements.rs:504-538 | crates/xberg/src/extraction/docx/math/elements.rs:541-575 | crates/xberg/src/extraction/docx/math/elements.rs:608-642 | crates/xberg/src/extraction/docx/math/elements.rs:694-726 | crates/xberg/src/extraction/docx/math/elements.rs:732-766 | crates/xberg/src/extraction/docx/math/elements.rs:799-835 β€” These 17 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 17 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 17 times.
D4 Β· Code Duplication Β· Members sharing a duplicated core (13 members, 50+ identical tokens) Β· Γ—1
  • Members sharing a duplicated core (13 members, 50+ identical tokens) crates/xberg/src/extractors/docbook.rs:164 β€” crates/xberg/src/extractors/docbook.rs:164-232 | crates/xberg/src/extractors/docbook.rs:257-526 | crates/xberg/src/extractors/docbook.rs:530-860 | crates/xberg/src/extractors/docbook.rs:870-1042 | crates/xberg/src/extractors/docbook.rs:1045-1111 | crates/xberg/src/extractors/fictionbook.rs:52-130 | crates/xberg/src/extractors/fictionbook.rs:391-450 | crates/xberg/src/extractors/fictionbook.rs:459-565 | crates/xberg/src/extractors/fictionbook.rs:574-657 | crates/xberg/src/extractors/fictionbook.rs:673-847 | crates/xberg/src/extractors/fictionbook.rs:865-984 | crates/xberg/src/extractors/fictionbook.rs:1032-1092 | crates/xberg/src/extractors/jats/mod.rs:231-530 β€” These 13 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 13 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 13 times.
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/xberg-native-pdf/src/rendering/page_renderer.rs:4964 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4964-5076 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5867-5946 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6053-6121 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6133-6181 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6194-6248 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6469-6610 β€” 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 Β· Duplicated block (4–107 lines × 3) Β· Γ—1
  • Duplicated block (4–107 lines × 3) crates/xberg/src/extractors/docx.rs:1014 β€” crates/xberg/src/extractors/docx.rs:1014-1017 | crates/xberg/src/extractors/odp.rs:444-549 | crates/xberg/src/extractors/odt.rs:1652-1758 β€” before extracting anything, compare `crates/xberg/src/extractors/docx.rs` and `crates/xberg/src/extractors/odp.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (69 lines × 2) Β· Γ—1
  • Duplicated block (69 lines × 2) crates/xberg/src/core/pipeline/features.rs:450 β€” crates/xberg/src/core/pipeline/features.rs:450-518 | crates/xberg/src/core/pipeline/features.rs:647-715 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (64–68 lines × 2) Β· Γ—1
  • Duplicated block (64–68 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2843 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2843-2910 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:2982-3045 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (43–54 lines × 3) Β· Γ—1
  • Duplicated block (43–54 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2060 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2060-2113 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2176-2218 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2390-2432 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (50 lines × 2) Β· Γ—1
  • Duplicated block (50 lines × 2) crates/xberg/src/candle_ocr/ocr_result.rs:211 β€” crates/xberg/src/candle_ocr/ocr_result.rs:211-260 | crates/xberg/src/llm/vlm_ocr.rs:323-372 β€” before extracting anything, compare `crates/xberg/src/candle_ocr/ocr_result.rs` and `crates/xberg/src/llm/vlm_ocr.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (42–47 lines × 2) Β· Γ—1
  • Duplicated block (42–47 lines × 2) crates/xberg-native-pdf/src/fonts/cff_encoding.rs:161 β€” crates/xberg-native-pdf/src/fonts/cff_encoding.rs:161-202 | crates/xberg-native-pdf/src/fonts/cff_encoding.rs:215-261 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (38–41 lines × 2) Β· Γ—1
  • Duplicated block (38–41 lines × 2) crates/xberg/src/pdf/structure/regions/table_recognition.rs:1458 β€” crates/xberg/src/pdf/structure/regions/table_recognition.rs:1458-1495 | crates/xberg/src/pdf/structure/regions/tables.rs:295-335 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (34–40 lines × 2) Β· Γ—1
  • Duplicated block (34–40 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1465 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1465-1504 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1702-1735 β€” before extracting anything, compare `crates/xberg-native-pdf/src/rendering/page_renderer.rs` and `crates/xberg-native-pdf/src/rendering/separation_renderer.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 180 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (40 lines × 2) Β· Γ—1
  • Duplicated block (40 lines × 2) crates/xberg/src/pdf/structure/pipeline.rs:6043 β€” crates/xberg/src/pdf/structure/pipeline.rs:6043-6082 | crates/xberg/src/pdf/structure/pipeline.rs:6108-6147 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (35 lines × 2) Β· Γ—1
  • Duplicated block (35 lines × 2) crates/xberg-native-pdf/src/structure/parser.rs:593 β€” crates/xberg-native-pdf/src/structure/parser.rs:593-627 | crates/xberg-native-pdf/src/structure/parser.rs:652-686 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (32–33 lines × 2) Β· Γ—1
  • Duplicated block (32–33 lines × 2) crates/xberg-native-pdf/src/document/extract_api.rs:2043 β€” crates/xberg-native-pdf/src/document/extract_api.rs:2043-2075 | crates/xberg-native-pdf/src/document/extract_api.rs:2080-2111 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (26–33 lines × 2) Β· Γ—1
  • Duplicated block (26–33 lines × 2) crates/xberg-native-pdf/src/rendering/sidecar.rs:510 β€” crates/xberg-native-pdf/src/rendering/sidecar.rs:510-535 | crates/xberg-native-pdf/src/rendering/sidecar.rs:676-708 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (28–33 lines × 2) Β· Γ—1
  • Duplicated block (28–33 lines × 2) crates/xberg/src/extractors/pdf/mod.rs:2564 β€” crates/xberg/src/extractors/pdf/mod.rs:2564-2596 | crates/xberg/src/extractors/pdf/mod.rs:2853-2880 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (32 lines × 4) Β· Γ—1
  • Duplicated block (32 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2072 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2072-2103 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2181-2212 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2282-2313 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2395-2426 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (18–31 lines × 2) Β· Γ—1
  • Duplicated block (18–31 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5745 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5745-5775 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6545-6562 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (30–31 lines × 2) Β· Γ—1
  • Duplicated block (30–31 lines × 2) crates/xberg/src/keywords/yake/preprocessor.rs:248 β€” crates/xberg/src/keywords/yake/preprocessor.rs:248-277 | crates/xberg/src/pdf/structure/classify.rs:1863-1893 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (22–30 lines × 3) Β· Γ—1
  • Duplicated block (22–30 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5025 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5025-5049 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5711-5740 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6520-6541 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (30 lines × 2) Β· Γ—1
  • Duplicated block (30 lines × 2) crates/xberg-tesseract/src/api.rs:1500 β€” crates/xberg-tesseract/src/api.rs:1500-1529 | crates/xberg-tesseract/src/api.rs:1554-1583 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (29–30 lines × 2) Β· Γ—1
  • Duplicated block (29–30 lines × 2) crates/xberg/src/pdf/structure/assembly.rs:150 β€” crates/xberg/src/pdf/structure/assembly.rs:150-179 | crates/xberg/src/pdf/structure/assembly.rs:498-526 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (28–29 lines × 2) Β· Γ—1
  • Duplicated block (28–29 lines × 2) crates/xberg/src/extractors/fictionbook.rs:604 β€” crates/xberg/src/extractors/fictionbook.rs:604-631 | crates/xberg/src/extractors/fictionbook.rs:991-1019 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (4–28 lines × 3) Β· Γ—1
  • Duplicated block (4–28 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1554 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1554-1557 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1781-1806 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1889-1916 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (28 lines × 2) Β· Γ—1
  • Duplicated block (28 lines × 2) crates/xberg/src/pdf/structure/regions/table_recognition.rs:1690 β€” crates/xberg/src/pdf/structure/regions/table_recognition.rs:1690-1717 | crates/xberg/src/pdf/structure/regions/tables.rs:113-140 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (27 lines × 2) Β· Γ—1
  • Duplicated block (27 lines × 2) crates/xberg/src/ocr/tesseract_backend.rs:479 β€” crates/xberg/src/ocr/tesseract_backend.rs:479-505 | crates/xberg/src/ocr/tesseract_backend.rs:578-604 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (26 lines × 2) Β· Γ—1
  • Duplicated block (26 lines × 2) crates/xberg/src/pdf/native/table.rs:173 β€” crates/xberg/src/pdf/native/table.rs:173-198 | crates/xberg/src/pdf/native/table.rs:294-319 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (18–25 lines × 4) Β· Γ—1
  • Duplicated block (18–25 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2034 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2034-2058 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2157-2174 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2255-2275 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2370-2388 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (16–25 lines × 2) Β· Γ—1
  • Duplicated block (16–25 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5584 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5584-5599 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5659-5683 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (13–25 lines × 2) Β· Γ—1
  • Duplicated block (13–25 lines × 2) crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1002 β€” crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1002-1026 | crates/xberg/src/extractors/pdf/ocr/pipeline.rs:1161-1173 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (20–24 lines × 2) Β· Γ—1
  • Duplicated block (20–24 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6055 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:6055-6078 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6136-6155 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (18–23 lines × 2) Β· Γ—1
  • Duplicated block (18–23 lines × 2) crates/xberg-native-pdf/src/decoders/ccitt.rs:67 β€” crates/xberg-native-pdf/src/decoders/ccitt.rs:67-89 | crates/xberg-native-pdf/src/decoders/ccitt.rs:143-160 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (19–22 lines × 3) Β· Γ—1
  • Duplicated block (19–22 lines × 3) crates/xberg/src/extractors/docbook.rs:1013 β€” crates/xberg/src/extractors/docbook.rs:1013-1034 | crates/xberg/src/extractors/docbook.rs:1318-1336 | crates/xberg/src/extractors/docbook.rs:1378-1396 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (19–22 lines × 2) Β· Γ—1
  • Duplicated block (19–22 lines × 2) crates/xberg-native-pdf/src/extractors/forms.rs:234 β€” crates/xberg-native-pdf/src/extractors/forms.rs:234-255 | crates/xberg-native-pdf/src/extractors/page_labels.rs:158-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 both call sites, so a change lands once.
D4 Β· Code Duplication Β· Duplicated block (21–22 lines × 2) Β· Γ—1
  • Duplicated block (21–22 lines × 2) crates/xberg/src/pdf/structure/classify.rs:997 β€” crates/xberg/src/pdf/structure/classify.rs:997-1017 | crates/xberg/src/pdf/structure/layout_classify.rs:350-371 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/classify.rs` and `crates/xberg/src/pdf/structure/layout_classify.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (20–21 lines × 3) Β· Γ—1
  • Duplicated block (20–21 lines × 3) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2007 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2007-2026 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2123-2143 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2336-2356 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (15–21 lines × 2) Β· Γ—1
  • Duplicated block (15–21 lines × 2) crates/xberg-native-pdf/src/extractors/paths.rs:382 β€” crates/xberg-native-pdf/src/extractors/paths.rs:382-402 | crates/xberg-native-pdf/src/extractors/paths.rs:408-422 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (20 lines × 5) Β· Γ—1
  • Duplicated block (20 lines × 5) crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1767 β€” crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1767-1786 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1806-1825 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1845-1864 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1884-1903 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:1939-1958 β€” all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (20 lines × 3) Β· Γ—1
  • Duplicated block (20 lines × 3) crates/xberg-native-pdf/src/pipeline/config.rs:82 β€” crates/xberg-native-pdf/src/pipeline/config.rs:82-101 | crates/xberg-native-pdf/src/pipeline/config.rs:166-185 | crates/xberg-native-pdf/src/pipeline/config.rs:194-213 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (17–20 lines × 2) Β· Γ—1
  • Duplicated block (17–20 lines × 2) crates/xberg-native-pdf/src/encryption/algorithms.rs:409 β€” crates/xberg-native-pdf/src/encryption/algorithms.rs:409-428 | crates/xberg-native-pdf/src/encryption/algorithms.rs:679-695 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (4–20 lines × 4) Β· Γ—1
  • Duplicated block (4–20 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1629 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1629-1632 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1724-1743 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1841-1852 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2702-2705 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (12–20 lines × 2) Β· Γ—1
  • Duplicated block (12–20 lines × 2) crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1194 β€” crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1194-1213 | crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:1729-1740 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (19 lines × 8) Β· Γ—1
  • Duplicated block (19 lines × 8) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1757 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1757-1775 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1864-1882 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2083-2101 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2192-2210 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2293-2311 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2406-2424 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2507-2525 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2715-2733 β€” all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (16–19 lines × 3) Β· Γ—1
  • Duplicated block (16–19 lines × 3) crates/xberg-native-pdf/src/content/parser.rs:130 β€” crates/xberg-native-pdf/src/content/parser.rs:130-148 | crates/xberg-native-pdf/src/content/parser.rs:486-501 | crates/xberg-native-pdf/src/content/parser.rs:1715-1730 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (19 lines × 3) Β· Γ—1
  • Duplicated block (19 lines × 3) crates/xberg-native-pdf/src/structure/parser.rs:565 β€” crates/xberg-native-pdf/src/structure/parser.rs:565-583 | crates/xberg-native-pdf/src/structure/parser.rs:595-613 | crates/xberg-native-pdf/src/structure/parser.rs:654-672 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (17–19 lines × 2) Β· Γ—1
  • Duplicated block (17–19 lines × 2) crates/xberg/src/engine/extract_impl.rs:992 β€” crates/xberg/src/engine/extract_impl.rs:992-1010 | crates/xberg/src/engine/extract_impl.rs:1055-1071 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (18 lines × 3) Β· Γ—1
  • Duplicated block (18 lines × 3) crates/xberg/src/layout/mod.rs:368 β€” crates/xberg/src/layout/mod.rs:368-385 | crates/xberg/src/layout/mod.rs:457-474 | crates/xberg/src/layout/mod.rs:555-572 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (8–18 lines × 2) Β· Γ—1
  • Duplicated block (8–18 lines × 2) crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1266 β€” crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1266-1283 | crates/xberg-native-pdf/src/pipeline/reading_order/xycut.rs:1447-1454 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (12–18 lines × 2) Β· Γ—1
  • Duplicated block (12–18 lines × 2) tools/benchmark-harness/src/batch_diagnostic.rs:222 β€” tools/benchmark-harness/src/batch_diagnostic.rs:222-233 | tools/benchmark-harness/src/comparison/extraction_config.rs:278-295 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (12–17 lines × 4) Β· Γ—1
  • Duplicated block (12–17 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:4965 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:4965-4981 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5583-5594 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5658-5669 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6200-6213 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (17 lines × 4) Β· Γ—1
  • Duplicated block (17 lines × 4) crates/xberg/src/extractors/docbook.rs:213 β€” crates/xberg/src/extractors/docbook.rs:213-229 | crates/xberg/src/extractors/docbook.rs:507-523 | crates/xberg/src/extractors/docbook.rs:828-844 | crates/xberg/src/extractors/docbook.rs:1092-1108 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (16–17 lines × 3) Β· Γ—1
  • Duplicated block (16–17 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs:92 β€” crates/xberg-native-pdf/src/document/extract_api.rs:92-107 | crates/xberg-native-pdf/src/document/extract_api.rs:727-743 | crates/xberg-native-pdf/src/document/extract_api.rs:1183-1198 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (10–16 lines × 2) Β· Γ—1
  • Duplicated block (10–16 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1290 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1290-1305 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1396-1405 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (12–16 lines × 2) Β· Γ—1
  • Duplicated block (12–16 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:6976 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:6976-6991 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:7072-7083 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (15–16 lines × 2) Β· Γ—1
  • Duplicated block (15–16 lines × 2) crates/xberg/src/extractors/pptx.rs:536 β€” crates/xberg/src/extractors/pptx.rs:536-551 | crates/xberg/src/extractors/pptx.rs:555-569 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (13–16 lines × 2) Β· Γ—1
  • Duplicated block (13–16 lines × 2) crates/xberg/src/late_interaction/mod.rs:367 β€” crates/xberg/src/late_interaction/mod.rs:367-382 | crates/xberg/src/sparse_embeddings/mod.rs:245-257 β€” `crates/xberg/src/late_interaction/mod.rs` and `crates/xberg/src/sparse_embeddings/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other β€” this scan matched 3 separate duplicated blocks between them, totalling at least 38 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 Β· Code Duplication Β· Duplicated block (15 lines × 5) Β· Γ—1
  • Duplicated block (15 lines × 5) crates/xberg-pdfium-render/src/pdf/document/fonts.rs:316 β€” crates/xberg-pdfium-render/src/pdf/document/fonts.rs:316-330 | crates/xberg-pdfium-render/src/pdf/document/fonts.rs:447-461 | crates/xberg-pdfium-render/src/pdf/font.rs:230-244 | crates/xberg-pdfium-render/src/pdf/font.rs:406-420 | crates/xberg-pdfium-render/src/pdfium.rs:388-402 β€” there are 5 copies across 3 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 Β· Code Duplication Β· Duplicated block (15 lines × 4) Β· Γ—1
  • Duplicated block (15 lines × 4) crates/xberg-native-pdf/src/fonts/font_dict.rs:6146 β€” crates/xberg-native-pdf/src/fonts/font_dict.rs:6146-6160 | crates/xberg-native-pdf/src/fonts/font_dict.rs:6287-6301 | crates/xberg-native-pdf/src/text/kangxi.rs:86-100 | crates/xberg-native-pdf/src/text/kangxi.rs:132-146 β€” 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.
D4 Β· Code Duplication Β· Duplicated block (11–15 lines × 3) Β· Γ—1
  • Duplicated block (11–15 lines × 3) crates/xberg-native-pdf/src/fonts/encoding.rs:314 β€” crates/xberg-native-pdf/src/fonts/encoding.rs:314-324 | crates/xberg-native-pdf/src/fonts/font_dict.rs:5793-5807 | crates/xberg/src/extractors/rtf/encoding.rs:69-79 β€” before extracting anything, compare `crates/xberg-native-pdf/src/fonts/encoding.rs` and `crates/xberg-native-pdf/src/fonts/font_dict.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (10–15 lines × 2) Β· Γ—1
  • Duplicated block (10–15 lines × 2) crates/xberg-native-pdf/src/document/tables.rs:138 β€” crates/xberg-native-pdf/src/document/tables.rs:138-147 | crates/xberg-native-pdf/src/document/tables.rs:296-310 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (11–15 lines × 2) Β· Γ—1
  • Duplicated block (11–15 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:1203 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:1203-1217 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:1230-1240 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (6–15 lines × 2) Β· Γ—1
  • Duplicated block (6–15 lines × 2) crates/xberg-native-pdf/src/text/word_boundary.rs:159 β€” crates/xberg-native-pdf/src/text/word_boundary.rs:159-164 | crates/xberg-native-pdf/src/text/word_boundary.rs:165-179 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (3–15 lines × 4) Β· Γ—1
  • Duplicated block (3–15 lines × 4) crates/xberg/src/extraction/email/msg_props.rs:33 β€” crates/xberg/src/extraction/email/msg_props.rs:33-47 | crates/xberg/src/extraction/email/msg_props.rs:77-79 | crates/xberg/src/extraction/email/msg_props.rs:165-179 | crates/xberg/src/extraction/email/msg_props.rs:286-288 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (13–15 lines × 2) Β· Γ—1
  • Duplicated block (13–15 lines × 2) crates/xberg/src/pdf/structure/lines.rs:120 β€” crates/xberg/src/pdf/structure/lines.rs:120-134 | tools/benchmark-harness/src/noise_detection/mod.rs:312-324 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made twice.
D4 Β· Code Duplication Β· Duplicated block (11–14 lines × 4) Β· Γ—1
  • Duplicated block (11–14 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5020 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5020-5030 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5703-5716 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6086-6096 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6514-6525 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (12–14 lines × 2) Β· Γ—1
  • Duplicated block (12–14 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:7839 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:7839-7852 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:8020-8031 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (10–14 lines × 2) Β· Γ—1
  • Duplicated block (10–14 lines × 2) crates/xberg/src/extractors/markdown.rs:220 β€” crates/xberg/src/extractors/markdown.rs:220-233 | crates/xberg/src/extractors/markdown.rs:587-596 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (13 lines × 4) Β· Γ—1
  • Duplicated block (13 lines × 4) crates/xberg/src/extractors/docbook.rs:1027 β€” crates/xberg/src/extractors/docbook.rs:1027-1039 | crates/xberg/src/extractors/docbook.rs:1329-1341 | crates/xberg/src/extractors/docbook.rs:1389-1401 | crates/xberg/src/extractors/fictionbook.rs:1013-1025 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (11–13 lines × 3) Β· Γ—1
  • Duplicated block (11–13 lines × 3) crates/xberg-native-pdf/src/fonts/cff_encoding.rs:575 β€” crates/xberg-native-pdf/src/fonts/cff_encoding.rs:575-587 | crates/xberg-native-pdf/src/fonts/cff_encoding.rs:630-641 | crates/xberg-native-pdf/src/fonts/cff_encoding.rs:721-731 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (4–13 lines × 4) Β· Γ—1
  • Duplicated block (4–13 lines × 4) crates/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:223 β€” crates/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:223-229 | crates/xberg-native-pdf/src/rendering/resolution/separation_backend.rs:244-247 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2466-2478 | crates/xberg-native-pdf/src/rendering/separation_renderer.rs:2489-2492 β€” 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.
D4 Β· Code Duplication Β· Duplicated block (10–13 lines × 2) Β· Γ—1
  • Duplicated block (10–13 lines × 2) crates/xberg-native-pdf/src/structure/parser.rs:515 β€” crates/xberg-native-pdf/src/structure/parser.rs:515-527 | crates/xberg-native-pdf/src/structure/parser.rs:552-561 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (7–13 lines × 3) Β· Γ—1
  • Duplicated block (7–13 lines × 3) crates/xberg/src/extractors/pdf/mod.rs:1270 β€” crates/xberg/src/extractors/pdf/mod.rs:1270-1276 | crates/xberg/src/extractors/pdf/mod.rs:1317-1329 | crates/xberg/src/extractors/pdf/mod.rs:1378-1390 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (9–12 lines × 2) Β· Γ—1
  • Duplicated block (9–12 lines × 2) crates/xberg-native-pdf/src/extractors/images.rs:2818 β€” crates/xberg-native-pdf/src/extractors/images.rs:2818-2829 | crates/xberg-native-pdf/src/extractors/images.rs:2868-2876 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (11 lines × 4) Β· Γ—1
  • Duplicated block (11 lines × 4) crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:261 β€” crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:261-271 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:378-388 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:704-714 | crates/xberg-candle-ocr/src/models/paddleocr_vl/model.rs:885-895 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (10–11 lines × 3) Β· Γ—1
  • Duplicated block (10–11 lines × 3) crates/xberg/src/extractors/djot_format/extractor.rs:470 β€” crates/xberg/src/extractors/djot_format/extractor.rs:470-480 | crates/xberg/src/extractors/djot_format/extractor.rs:490-500 | crates/xberg/src/extractors/djot_format/extractor.rs:642-651 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (3–11 lines × 3) Β· Γ—1
  • Duplicated block (3–11 lines × 3) crates/xberg-native-pdf/src/redaction/text_engine.rs:392 β€” crates/xberg-native-pdf/src/redaction/text_engine.rs:392-394 | crates/xberg-native-pdf/src/redaction/text_engine.rs:410-420 | crates/xberg-native-pdf/src/redaction/text_engine.rs:440-450 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (3–11 lines × 4) Β· Γ—1
  • Duplicated block (3–11 lines × 4) tools/benchmark-harness/src/structural_sidecar/scoring.rs:462 β€” tools/benchmark-harness/src/structural_sidecar/scoring.rs:462-472 | tools/benchmark-harness/src/structural_sidecar/scoring.rs:475-477 | tools/benchmark-harness/src/structural_sidecar/scoring.rs:501-510 | tools/benchmark-harness/src/structural_sidecar/scoring.rs:513-515 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (8–10 lines × 4) Β· Γ—1
  • Duplicated block (8–10 lines × 4) crates/xberg/src/pdf/structure/classify.rs:378 β€” crates/xberg/src/pdf/structure/classify.rs:378-385 | crates/xberg/src/pdf/structure/classify.rs:610-617 | crates/xberg/src/pdf/structure/layout_classify.rs:297-306 | crates/xberg/src/pdf/structure/layout_classify.rs:410-417 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/classify.rs` and `crates/xberg/src/pdf/structure/layout_classify.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (4–10 lines × 3) Β· Γ—1
  • Duplicated block (4–10 lines × 3) crates/xberg-candle-ocr/src/download_guard.rs:176 β€” crates/xberg-candle-ocr/src/download_guard.rs:176-185 | crates/xberg/src/layout/model_manager.rs:42-45 | crates/xberg/src/model_download.rs:470-479 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 3 times.
D4 Β· Code Duplication Β· Duplicated block (6–10 lines × 2) Β· Γ—1
  • Duplicated block (6–10 lines × 2) crates/xberg-native-pdf/src/rendering/page_renderer.rs:3704 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:3704-3713 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:4219-4224 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited.
D4 Β· Code Duplication Β· Duplicated block (8–10 lines × 3) Β· Γ—1
  • Duplicated block (8–10 lines × 3) crates/xberg/src/extractors/typst.rs:823 β€” crates/xberg/src/extractors/typst.rs:823-832 | crates/xberg/src/extractors/typst.rs:837-846 | crates/xberg/src/extractors/typst.rs:849-856 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (8–9 lines × 4) Β· Γ—1
  • Duplicated block (8–9 lines × 4) crates/xberg-native-pdf/src/rendering/page_renderer.rs:2021 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:2021-2028 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2137-2145 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2236-2243 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:2350-2358 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (8–9 lines × 3) Β· Γ—1
  • Duplicated block (8–9 lines × 3) crates/xberg/src/extractors/fictionbook.rs:56 β€” crates/xberg/src/extractors/fictionbook.rs:56-63 | crates/xberg/src/extractors/fictionbook.rs:397-404 | crates/xberg/src/extractors/jats/mod.rs:250-258 β€” before extracting anything, compare `crates/xberg/src/extractors/fictionbook.rs` and `crates/xberg/src/extractors/jats/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (6–9 lines × 3) Β· Γ—1
  • Duplicated block (6–9 lines × 3) crates/xberg/src/text/token_reduction/core/word_filtering.rs:59 β€” crates/xberg/src/text/token_reduction/core/word_filtering.rs:59-67 | crates/xberg/src/text/token_reduction/core/word_filtering.rs:94-101 | crates/xberg/src/text/token_reduction/core/word_filtering.rs:126-131 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (1–9 lines × 3) Β· Γ—1
  • Duplicated block (1–9 lines × 3) crates/xberg/src/pdf/structure/adapters.rs:478 β€” crates/xberg/src/pdf/structure/adapters.rs:478-478 | crates/xberg/src/pdf/structure/adapters.rs:1596-1604 | crates/xberg/src/pdf/structure/pipeline.rs:1280-1288 β€” before extracting anything, compare `crates/xberg/src/pdf/structure/adapters.rs` and `crates/xberg/src/pdf/structure/pipeline.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 16) Β· Γ—1
  • Duplicated block (8 lines × 16) crates/xberg/src/extraction/docx/math/collect.rs:138 β€” crates/xberg/src/extraction/docx/math/collect.rs:138-145 | crates/xberg/src/extraction/docx/math/collect.rs:175-182 | crates/xberg/src/extraction/docx/math/collect.rs:213-220 | crates/xberg/src/extraction/docx/math/elements.rs:8-15 | crates/xberg/src/extraction/docx/math/elements.rs:80-87 | crates/xberg/src/extraction/docx/math/elements.rs:145-152 | crates/xberg/src/extraction/docx/math/elements.rs:235-242 | crates/xberg/src/extraction/docx/math/elements.rs:359-366 | crates/xberg/src/extraction/docx/math/elements.rs:428-435 | crates/xberg/src/extraction/docx/math/elements.rs:467-474 | crates/xberg/src/extraction/docx/math/elements.rs:507-514 | crates/xberg/src/extraction/docx/math/elements.rs:544-551 | crates/xberg/src/extraction/docx/math/elements.rs:612-619 | crates/xberg/src/extraction/docx/math/elements.rs:696-703 | crates/xberg/src/extraction/docx/math/elements.rs:734-741 | crates/xberg/src/extraction/docx/math/elements.rs:803-810 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (8 lines × 7) Β· Γ—1
  • Duplicated block (8 lines × 7) crates/xberg-tesseract/src/api.rs:501 β€” crates/xberg-tesseract/src/api.rs:501-508 | crates/xberg-tesseract/src/api.rs:522-529 | crates/xberg-tesseract/src/api.rs:543-550 | crates/xberg-tesseract/src/api.rs:635-642 | crates/xberg-tesseract/src/api.rs:656-663 | crates/xberg-tesseract/src/api.rs:677-684 | crates/xberg-tesseract/src/api.rs:694-701 β€” all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (7–8 lines × 4) Β· Γ—1
  • Duplicated block (7–8 lines × 4) crates/xberg-native-pdf/src/optional_content.rs:162 β€” crates/xberg-native-pdf/src/optional_content.rs:162-168 | crates/xberg-native-pdf/src/structure/parser.rs:103-110 | crates/xberg/src/pdf/native/metadata.rs:315-321 | crates/xberg/src/pdf/xref_revisions.rs:209-215 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach β€” a location they all depend on today, or a new shared one if there is none β€” and call it from each site; until then, every change has to be made 4 times.
D4 Β· Code Duplication Β· Duplicated block (2–8 lines × 3) Β· Γ—1
  • Duplicated block (2–8 lines × 3) tools/benchmark-harness/src/json_quality.rs:136 β€” tools/benchmark-harness/src/json_quality.rs:136-143 | tools/benchmark-harness/src/json_quality.rs:200-201 | tools/benchmark-harness/src/json_quality.rs:346-353 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 13) Β· Γ—1
  • Duplicated block (7 lines × 13) crates/xberg/src/extractors/docbook.rs:170 β€” crates/xberg/src/extractors/docbook.rs:170-176 | crates/xberg/src/extractors/docbook.rs:281-287 | crates/xberg/src/extractors/docbook.rs:562-568 | crates/xberg/src/extractors/docbook.rs:875-881 | crates/xberg/src/extractors/docbook.rs:1049-1055 | crates/xberg/src/extractors/fictionbook.rs:56-62 | crates/xberg/src/extractors/fictionbook.rs:397-403 | crates/xberg/src/extractors/fictionbook.rs:464-470 | crates/xberg/src/extractors/fictionbook.rs:579-585 | crates/xberg/src/extractors/fictionbook.rs:685-691 | crates/xberg/src/extractors/fictionbook.rs:875-881 | crates/xberg/src/extractors/fictionbook.rs:1040-1046 | crates/xberg/src/extractors/jats/mod.rs:250-256 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (5–7 lines × 4) Β· Γ—1
  • Duplicated block (5–7 lines × 4) crates/xberg/src/extractors/latex/mod.rs:498 β€” crates/xberg/src/extractors/latex/mod.rs:498-502 | crates/xberg/src/extractors/latex/mod.rs:524-530 | crates/xberg/src/extractors/latex/mod.rs:548-554 | crates/xberg/src/extractors/latex/mod.rs:679-683 β€” all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (2–7 lines × 6) Β· Γ—1
  • Duplicated block (2–7 lines × 6) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5633 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5633-5639 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5696-5697 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5794-5799 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5922-5923 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6504-6505 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6581-6582 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (4–7 lines × 3) Β· Γ—1
  • Duplicated block (4–7 lines × 3) crates/xberg/src/extractors/docbook.rs:201 β€” crates/xberg/src/extractors/docbook.rs:201-204 | crates/xberg/src/extractors/docbook.rs:1352-1358 | crates/xberg/src/extractors/fictionbook.rs:151-157 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (3–6 lines × 3) Β· Γ—1
  • Duplicated block (3–6 lines × 3) crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1365 β€” crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1365-1367 | crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1378-1383 | crates/xberg-candle-ocr/src/models/deepseek_ocr/model.rs:1415-1420 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (5 lines × 6) Β· Γ—1
  • Duplicated block (5 lines × 6) crates/xberg/src/extractors/excel.rs:400 β€” crates/xberg/src/extractors/excel.rs:400-404 | crates/xberg/src/extractors/iwork/keynote.rs:202-206 | crates/xberg/src/extractors/iwork/numbers.rs:1333-1337 | crates/xberg/src/extractors/iwork/pages.rs:165-169 | crates/xberg/src/extractors/ppt.rs:79-83 | crates/xberg/src/extractors/pptx.rs:506-510 β€” before extracting anything, compare `crates/xberg/src/extractors/iwork/keynote.rs` and `crates/xberg/src/extractors/iwork/pages.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (2–5 lines × 3) Β· Γ—1
  • Duplicated block (2–5 lines × 3) crates/xberg-native-pdf/src/document/extract_api.rs:467 β€” crates/xberg-native-pdf/src/document/extract_api.rs:467-468 | crates/xberg-native-pdf/src/document/extract_api.rs:1313-1317 | crates/xberg-native-pdf/src/document/extract_api.rs:1669-1673 β€” all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (2–5 lines × 6) Β· Γ—1
  • Duplicated block (2–5 lines × 6) crates/xberg-native-pdf/src/rendering/page_renderer.rs:5072 β€” crates/xberg-native-pdf/src/rendering/page_renderer.rs:5072-5073 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:5942-5946 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6117-6118 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6177-6181 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6242-6243 | crates/xberg-native-pdf/src/rendering/page_renderer.rs:6605-6606 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (7 lines × 6) Β· Γ—1
  • Duplicated block (7 lines × 6) crates/xberg/src/plugins/embedding.rs:150 β€” crates/xberg/src/plugins/embedding.rs:150-156 | crates/xberg/src/plugins/extractor/mod.rs:68-74 | crates/xberg/src/plugins/ocr.rs:839-846 | crates/xberg/src/plugins/reranker.rs:151-157 | crates/xberg/src/plugins/tokenizer.rs:135-141 | crates/xberg/src/plugins/validator/mod.rs:45-52 β€” the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times.
D4 Β· Code Duplication Β· Duplicated block (6 lines × 10) Β· Γ—1
  • Duplicated block (6 lines × 10) crates/xberg/src/types/djot.rs:35 β€” crates/xberg/src/types/djot.rs:35-40 | crates/xberg/src/types/formats.rs:169-174 | crates/xberg/src/types/formats.rs:651-656 | crates/xberg/src/types/formats.rs:708-713 | crates/xberg/src/types/metadata.rs:716-721 | crates/xberg/src/types/metadata.rs:756-761 | crates/xberg/src/types/metadata.rs:796-801 | crates/xberg/src/types/metadata.rs:836-841 | crates/xberg/src/types/ocr_elements.rs:52-57 | crates/xberg/src/types/page.rs:93-98 β€” there are 10 copies across 5 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 10 sites; resolving a subset leaves the remainder to drift apart.
D4 Β· Code Duplication Β· Duplicated block (12 lines × 9) Β· Γ—1
  • Duplicated block (12 lines × 9) crates/xberg/src/extraction/docx/math/collect.rs:151 β€” crates/xberg/src/extraction/docx/math/collect.rs:151-162 | crates/xberg/src/extraction/docx/math/collect.rs:188-199 | crates/xberg/src/extraction/docx/math/collect.rs:227-238 | crates/xberg/src/extraction/docx/math/elements.rs:440-451 | crates/xberg/src/extraction/docx/math/elements.rs:480-491 | crates/xberg/src/extraction/docx/math/elements.rs:520-531 | crates/xberg/src/extraction/docx/math/elements.rs:708-719 | crates/xberg/src/extraction/docx/math/elements.rs:748-759 | crates/xberg/src/extraction/docx/math/elements.rs:817-828 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (12 lines × 10) Β· Γ—1
  • Duplicated block (12 lines × 10) crates/xberg/src/extraction/docx/math/collect.rs:153 β€” crates/xberg/src/extraction/docx/math/collect.rs:153-164 | crates/xberg/src/extraction/docx/math/collect.rs:190-201 | crates/xberg/src/extraction/docx/math/collect.rs:229-240 | crates/xberg/src/extraction/docx/math/elements.rs:252-263 | crates/xberg/src/extraction/docx/math/elements.rs:442-453 | crates/xberg/src/extraction/docx/math/elements.rs:482-493 | crates/xberg/src/extraction/docx/math/elements.rs:522-533 | crates/xberg/src/extraction/docx/math/elements.rs:710-721 | crates/xberg/src/extraction/docx/math/elements.rs:750-761 | crates/xberg/src/extraction/docx/math/elements.rs:819-830 β€” before extracting anything, compare `crates/xberg/src/extraction/docx/math/collect.rs` and `crates/xberg/src/extraction/docx/math/elements.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (12 lines × 6) Β· Γ—1
  • Duplicated block (12 lines × 6) crates/xberg/src/extraction/docx/math/elements.rs:24 β€” crates/xberg/src/extraction/docx/math/elements.rs:24-35 | crates/xberg/src/extraction/docx/math/elements.rs:96-107 | crates/xberg/src/extraction/docx/math/elements.rs:162-173 | crates/xberg/src/extraction/docx/math/elements.rs:374-385 | crates/xberg/src/extraction/docx/math/elements.rs:559-570 | crates/xberg/src/extraction/docx/math/elements.rs:624-635 β€” all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites β€” resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 Β· Code Duplication Β· Duplicated block (6 lines × 6) Β· Γ—1
  • Duplicated block (6 lines × 6) crates/xberg/src/extractors/docbook.rs:1174 β€” crates/xberg/src/extractors/docbook.rs:1174-1179 | crates/xberg/src/extractors/fictionbook.rs:770-775 | crates/xberg/src/extractors/jats/elements.rs:84-89 | crates/xberg/src/extractors/jats/elements.rs:102-107 | crates/xberg/src/extractors/jats/elements.rs:173-178 | crates/xberg/src/extractors/jats/parser.rs:165-170 β€” before extracting anything, compare `crates/xberg/src/extractors/docbook.rs` and `crates/xberg/src/extractors/fictionbook.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (35 lines × 5) Β· Γ—1
  • Duplicated block (35 lines × 5) tools/benchmark-harness/scripts/docling_extract.py:227 β€” tools/benchmark-harness/scripts/docling_extract.py:227-261 | tools/benchmark-harness/scripts/markitdown_extract.py:60-94 | tools/benchmark-harness/scripts/mineru_extract.py:186-220 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:68-102 | tools/benchmark-harness/scripts/unstructured_extract.py:77-111 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/markitdown_extract.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (21–26 lines × 2) Β· Γ—1
  • Duplicated block (21–26 lines × 2) integrations/python/llama-index/node_parsers/llama-index-node-parser-xberg/llama_index/node_parser/xberg/base.py:103 β€” integrations/python/llama-index/node_parsers/llama-index-node-parser-xberg/llama_index/node_parser/xberg/base.py:103-128 | integrations/python/llama-index/node_parsers/llama-index-node-parser-xberg/llama_index/node_parser/xberg/base.py:133-153 β€” both copies are in the same file, so extract the block into one function there and call it from each site β€” the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 Β· Code Duplication Β· Duplicated block (17 lines × 5) Β· Γ—1
  • Duplicated block (17 lines × 5) tools/benchmark-harness/scripts/docling_extract.py:207 β€” tools/benchmark-harness/scripts/docling_extract.py:207-223 | tools/benchmark-harness/scripts/markitdown_extract.py:40-56 | tools/benchmark-harness/scripts/mineru_extract.py:166-182 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:48-64 | tools/benchmark-harness/scripts/unstructured_extract.py:57-73 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/markitdown_extract.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (11 lines × 5) Β· Γ—1
  • Duplicated block (11 lines × 5) tools/benchmark-harness/scripts/docling_extract.py:296 β€” tools/benchmark-harness/scripts/docling_extract.py:296-306 | tools/benchmark-harness/scripts/markitdown_extract.py:127-137 | tools/benchmark-harness/scripts/mineru_extract.py:311-321 | tools/benchmark-harness/scripts/pymupdf4llm_extract.py:135-145 | tools/benchmark-harness/scripts/unstructured_extract.py:146-156 β€” before extracting anything, compare `tools/benchmark-harness/scripts/docling_extract.py` and `tools/benchmark-harness/scripts/markitdown_extract.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together β€” extracting one helper per block leaves the fork in place.
D4 Β· Code Duplication Β· Duplicated block (17–19 lines × 3) Β· Γ—1
  • Duplicated block (17–19 lines × 3) tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:138 β€” tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:138-155 | tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:172-190 | tools/generate_test_fixtures/src/generate_test_fixtures/odt_revisions.py:133-149 β€” there are 3 copies across 2 file(s) β€” more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `tools/generate_test_fixtures/src/generate_test_fixtures/docx_revisions.py:138` it does not close everything it opens, so those exact lines cannot be lifted as they stand β€” widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 Β· Code Duplication Β· Duplicated block (4–18 lines × 4) Β· Γ—1
  • Duplicated block (4–18 lines × 4) tools/generate_test_fixtures/src/generate_test_fixtures/odt_revisions.py:111 β€” tools/generate_test_fixtures/src/generate_test_fixtures/odt_revisions.py:111-114 | tools/generate_test_fixtures/src/generate_test_fixtures/pptx_comments.py:106-123 | tools/generate_test_fixtures/src/generate_test_fixtures/security_fixtures.py:44-61 | tools/generate_test_fixtures/src/generate_test_fixtures/xlsx_revisions.py:92-109 β€” the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach β€” a file they already depend on, or a new one alongside them β€” and call it from all 4 call sites, so a change lands once. 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.
D8 Β· Code Coverage Β· Coverage not measured Β· Γ—1
  • Coverage not measured β€” .NET and JavaScript/TypeScript suite β€” Coverage NOT MEASURED: the .NET half could not be measured β€” the repository wires up no coverage collector for `--collect:"XPlat Code Coverage"` to use; the JavaScript/TypeScript half could not be measured β€” the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_BROKEN_LOCKFILE  The lockfile at "REDACTED" is broken: expected a single document in the stream, but found more), so the suite never ran. This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
P12 Β· CI test-gate honesty Β· Test suite runs only after the merge Β· Γ—1
  • Test suite runs only after the merge β€” `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED` run(s) the test suite, but no workflow that runs tests is triggered by a pull request (or a merge queue) β€” so the suite reports on code that is already on the default branch. A red build there blocks nothing and the only remedy is a revert. Add the pull-request trigger to the workflow that runs your suite so the gate applies before the merge, not after it.
P3 Β· Security & performance tooling Β· SAST runs, but gates no merge Β· Γ—1
  • SAST runs, but gates no merge β€” `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED` run(s) a static-analysis scan, but no workflow that runs one is triggered by a pull request (or a merge queue, or an unfiltered push) β€” the scan fires on a schedule or a manual dispatch only. A vulnerable change therefore merges clean and is reported on the next scheduled run, by which time it is on the default branch and the only remedy is a follow-up fix. Add the pull-request trigger to the workflow that runs the scan so the finding arrives before the merge rather than after it.
R1 Β· Type Safety Β· Type Safety Β· Γ—1
  • Type Safety β€” 14 typed · 7 plain JS β€” the untyped files are cli-proxy/npm/install.js, cli-proxy/npm/test.mjs, integrations/node/n8n-nodes-xberg/index.js, scripts/ci/smoke_test_node_binding.js, scripts/publish/node/smoke-glibc-2-28.mjs, scripts/task/patch-demo-dev.mjs (+1 more).
R10 Β· Code Duplication Β· Duplicated block with local edits (19 matched lines × 2 locations) Β· Γ—1
  • Duplicated block with local edits (19 matched lines × 2 locations) cli-proxy/npm/install.js:209 β€” cli-proxy/npm/install.js:209 · cli-proxy/npm/install.js:244 β€” the two spans are one implementation copied and then locally edited β€” 158 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 (15 lines × 2 locations) Β· Γ—1
  • Duplicated block (15 lines × 2 locations) integrations/node/llamaindex-xberg/src/nodeParser.ts:84 β€” integrations/node/llamaindex-xberg/src/nodeParser.ts:84 · integrations/node/llamaindex-xberg/src/nodeParser.ts:111 β€” 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) Β· Γ—1
  • Duplicated block with local edits (14 matched lines × 2 locations) integrations/node/llamaindex-xberg/src/readerMapping.ts:479 β€” integrations/node/llamaindex-xberg/src/readerMapping.ts:479 · integrations/node/llamaindex-xberg/src/readerMapping.ts:499 β€” the two spans are one implementation copied and then locally edited β€” 87 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 (9 lines × 2 locations) Β· Γ—1
  • Duplicated block (9 lines × 2 locations) integrations/node/langchain-xberg/src/mapping.ts:130 β€” integrations/node/langchain-xberg/src/mapping.ts:130 · integrations/node/llamaindex-xberg/src/readerMapping.ts:373 β€” the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block β€” it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead β€” the whole function, component or branch these lines sit in β€” and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 Β· Code Duplication Β· Duplicated block (8 lines × 2 locations) Β· Γ—1
  • Duplicated block (8 lines × 2 locations) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:208 β€” integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:208 · integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:320 β€” 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 (7 lines × 2 locations) Β· Γ—1
  • Duplicated block (7 lines × 2 locations) integrations/node/langchain-xberg/src/mapping.ts:159 β€” integrations/node/langchain-xberg/src/mapping.ts:159 · integrations/node/langchain-xberg/src/mapping.ts:189 β€” 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.
R2 Β· Cyclomatic Complexity Β· Complex function buildMetadata (cyclomatic 18, cognitive 17) Β· Γ—1
  • Complex function buildMetadata (cyclomatic 18, cognitive 17) integrations/node/llamaindex-xberg/src/readerMapping.ts:341 β€” buildMetadata has cyclomatic complexity 18 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth β€” arms side by side rather than stacked β€” and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 Β· Cyclomatic Complexity Β· Complex function documentToJson (cyclomatic 12, cognitive 11) Β· Γ—1
  • Complex function documentToJson (cyclomatic 12, cognitive 11) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:116 β€” documentToJson has cyclomatic complexity 12 and cognitive complexity 11; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth β€” arms side by side rather than stacked β€” and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 Β· Cyclomatic Complexity Β· Complex function runExtractBatch (cyclomatic 11, cognitive 17) Β· Γ—1
  • Complex function runExtractBatch (cyclomatic 11, cognitive 17) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts:259 β€” runExtractBatch has cyclomatic complexity 11 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side β€” extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 Β· Cyclomatic Complexity Β· Complex function resultsToDocuments (cyclomatic 11, cognitive 15) Β· Γ—1
  • Complex function resultsToDocuments (cyclomatic 11, cognitive 15) integrations/node/llamaindex-xberg/src/readerMapping.ts:470 β€” resultsToDocuments has cyclomatic complexity 11 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 is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side β€” extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 Β· Cyclomatic Complexity Β· Complex function buildMetadata (cyclomatic 11, cognitive 10) Β· Γ—1
  • Complex function buildMetadata (cyclomatic 11, cognitive 10) integrations/node/langchain-xberg/src/mapping.ts:119 β€” buildMetadata has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth β€” arms side by side rather than stacked β€” and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 Β· Large Files Β· integrations/node/llamaindex-xberg/src/readerMapping.ts Β· Γ—1
  • integrations/node/llamaindex-xberg/src/readerMapping.ts: 466 lines of code integrations/node/llamaindex-xberg/src/readerMapping.ts:1 β€” integrations/node/llamaindex-xberg/src/readerMapping.ts has 466 significant lines (blank lines excluded), over the 400-line bar, and contains logic β€” a file this long is usually several responsibilities in one module.
R7 Β· Dead Code Β· Dead file (~389 LoC) Β· Γ—1
  • Dead file (~389 LoC) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts β€” no import path from any entry point (5 application, 10 tooling, 49 test roots considered), and no other file in the scanned tree imports it β€” nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 Β· Dead Code Β· Dead file (~333 LoC) Β· Γ—1
  • Dead file (~333 LoC) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.ts β€” no import path from any entry point (5 application, 10 tooling, 49 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.ts) β€” every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
R7 Β· Dead Code Β· Dead file (~66 LoC) Β· Γ—1
  • Dead file (~66 LoC) scripts/publish/node/smoke-glibc-2-28.mjs β€” no import path from any entry point (5 application, 10 tooling, 49 test roots considered), and no other file in the scanned tree imports it β€” nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 Β· Dead Code Β· Dead file (~3 LoC) Β· Γ—1
  • Dead file (~3 LoC) integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.constants.ts β€” no import path from any entry point (5 application, 10 tooling, 49 test roots considered), but 2 in-repo import(s) from 2 other file(s) do name it (integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.properties.ts, integrations/node/n8n-nodes-xberg/nodes/Xberg/Xberg.node.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
R8 Β· Dependency Hygiene Β· Unused dependency '@emnapi/core' Β· Γ—1
  • Unused dependency '@emnapi/core' β€” Declared in the root package.json but never imported anywhere in that package or its workspace members β€” no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 Β· Dependency Hygiene Β· Unused dependency '@emnapi/runtime' Β· Γ—1
  • Unused dependency '@emnapi/runtime' β€” Declared in the root package.json but never imported anywhere in that package or its workspace members β€” no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 Β· Dependency Hygiene Β· Unused dependency '@textlint-rule/textlint-rule-no-invalid-control-character' Β· Γ—1
  • Unused dependency '@textlint-rule/textlint-rule-no-invalid-control-character' β€” Declared in the root package.json but never imported anywhere in that package or its workspace members β€” no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
S1 Β· Cryptographic Hygiene Β· Third-party script without Subresource Integrity Β· Γ—1
  • Third-party script without Subresource Integrity docs-site/public/demo.html:29 β€” `https://cdn.tailwindcss.com` is executed by this page with no Subresource Integrity. Whoever can answer that request β€” the CDN, anyone who compromises it, anyone on the network path β€” runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time β€” the executed bytes can change with nobody touching this repository.
SC1 Β· Supply-chain hygiene Β· NuGet dependencies are not locked Β· Γ—1
  • NuGet dependencies are not locked β€” No packages.lock.json and no central package management β€” restores aren't reproducible or pinned (SSDF PW.4.4). Enable <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile> (commit the lockfile) or adopt Directory.Packages.props. Advisory β€” never scored.
Minor β€” 115 finding(s)
X7 Β· Silent fallback defaults Β· Silent fallback default on Err Β· Γ—39
  • Silent fallback default on Err crates/xberg/src/rendering/pdf/font.rs:148 β€” `sans_code` turns every `Err` into `0` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/api/openapi.rs:339 β€” `openapi_json` turns every `Err` into `"{}".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/chunking/yaml_section.rs:88 β€” `flatten_json` turns every `Err` into `Ok(Vec::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/chunking/yaml_section.rs:113 β€” `flatten_yaml` turns every `Err` into `Ok(Vec::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/doctor/cache.rs:182 β€” `unknown_dirs` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/engine/extract_impl.rs:1677 β€” `normalized_content_type` turns every `Err` into `"text/html".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/diagram/odf.rs:263 β€” `length_value` turns every `Err` into `0.0` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/diagram/pdf.rs:54 β€” `recover` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/email/msg.rs:115 β€” `direct_child_storage_paths` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/email/msg_props.rs:278 β€” `read_msg_recip_type` turns every `Err` into `0` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/mathml.rs:116 β€” `convert_mathml_str_to_latex` turns every `Err` into `Ok(String::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/pptx/mod.rs:247 β€” `extract_slide_images` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extraction/pptx/metadata.rs:361 β€” `extract_section_names` turns every `Err` into `Ok(HashMap::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/extractors/iwork/mod.rs:396 β€” `extract_metadata_from_zip` turns every `Err` into `crate::types::metadata::Metadata::default()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/ocr/processor/execution.rs:712 β€” `build_content_with_inline_tables` turns every `Err` into `String::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg/src/pdf/scan_detect.rs:437 β€” `fabricated_provenance_page_indices` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/document/annotations.rs:39 β€” `extract_widget_spans` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/document/annotations.rs:346 β€” `annotation_content_spans` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/document/images.rs:348 β€” `page_image_handles` turns every `Err` into `Ok(Vec::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/document/images.rs:749 β€” `extract_images_filtered` turns every `Err` into `Ok(Vec::new())` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/crypto/cbom.rs:88 β€” `cbom_json` turns every `Err` into `"{}".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err crates/xberg-native-pdf/src/structure/article_threads.rs:76 β€” `parse_article_threads` turns every `Err` into `Vec::new()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err packages/swift/rust/src/lib.rs:9226 β€” `key_values` turns every `Err` into `"null".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err packages/swift/rust/src/lib.rs:9901 β€” `page_spans` turns every `Err` into `"null".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err packages/swift/rust/src/lib.rs:9908 β€” `classifications` turns every `Err` into `"null".to_string()` β€” a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • + 14 more in this group β€” see findings.md.
X10 Β· Duplicated predicate Β· Duplicated predicate Β· Γ—25
  • Duplicated predicate integrations/node/langchain-xberg/src/mapping.ts:133 β€” `document.extractedKeywords && document.extractedKeywords.length > 0` appears character-identically in 2 files β€” integrations/node/langchain-xberg/src/mapping.ts, integrations/node/llamaindex-xberg/src/readerMapping.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 integrations/node/langchain-xberg/src/mapping.ts:151 β€” `document.processingWarnings && document.processingWarnings.length > 0` appears character-identically in 2 files β€” integrations/node/langchain-xberg/src/mapping.ts, integrations/node/llamaindex-xberg/src/readerMapping.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 integrations/node/langchain-xberg/src/loader.ts:42 β€” `filePath === undefined && data === undefined` appears character-identically in 2 files β€” integrations/node/langchain-xberg/src/loader.ts, integrations/node/llamaindex-xberg/src/readerMapping.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 tools/benchmark-harness/scripts/build_language_sidecar.py:134 β€” `not str(cache_dir) or not cache_dir.is_dir()` appears character-identically in 2 files β€” tools/benchmark-harness/scripts/build_language_sidecar.py, tools/benchmark-harness/scripts/plausibility_calibrate.py. 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/xberg/src/extractors/latex/mod.rs:465 β€” `!is_plain_tex && trimmed.contains("\\begin{document}")` appears character-identically in 2 files β€” crates/xberg/src/extractors/latex/mod.rs, crates/xberg/src/extractors/latex/parser.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/extractors/latex/mod.rs:470 β€” `!is_plain_tex && trimmed.contains("\\end{document}")` appears character-identically in 2 files β€” crates/xberg/src/extractors/latex/mod.rs, crates/xberg/src/extractors/latex/parser.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/extraction/doctags.rs:101 β€” `!is_standalone(name) && !is_paired(name)` appears character-identically in 2 files β€” crates/xberg/src/extraction/doctags.rs, crates/xberg/src/rendering/doctags.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/functions/mod.rs:176 β€” `!s.starts_with('{') || !s.ends_with('}')` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/functions/mod.rs, crates/xberg/src/extraction/mathml/render.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/spans_text.rs:848 β€” `!span.char_widths.is_empty() && span.char_widths.len() < char_count` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/document/spans_text.rs, crates/xberg-native-pdf/src/structure/table_extractor.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/extractors/epub/content.rs:966 β€” `!text.is_empty() && !text.ends_with(' ')` appears character-identically in 2 files β€” crates/xberg/src/extractors/epub/content.rs, crates/xberg/src/extractors/fictionbook.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/reading_order.rs:933 β€” `!text.is_empty() && !text.ends_with(' ') && !text.ends_with('\n')` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/document/reading_order.rs, crates/xberg/src/extractors/docbook.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/annotations.rs:733 β€” `!text.is_empty() && !text.ends_with('\n')` appears character-identically in 5 files β€” crates/xberg-native-pdf/src/document/annotations.rs, crates/xberg-native-pdf/src/document/text_assembly.rs, crates/xberg/src/extractors/asciidoc.rs, crates/xberg/src/extractors/fictionbook.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/mod.rs:921 β€” `!valid_start || !content[pos].is_ascii_digit()` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/document/mod.rs, crates/xberg-native-pdf/src/document/objects.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/pdf/hierarchy/types.rs:137 β€” `(start - 700.0).abs() < 1e-3 && (end - 740.0).abs() < 1e-3` appears character-identically in 2 files β€” crates/xberg/src/pdf/hierarchy/types.rs, crates/xberg/src/pdf/native/span_geometry.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/extractors/epub/mod.rs:630 β€” `ann.start < ann.end && end <= text.len()` appears character-identically in 2 files β€” crates/xberg/src/extractors/epub/mod.rs, crates/xberg/src/extractors/html.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/extractors/pdf/ocr/plausibility.rs:223 β€” `boundary.byte_start > boundary.byte_end || !native_text.is_char_boundary(boundary.byte_start) || !native_text.is_char_boundary(boundary.byte…` appears character-identically in 2 files β€” crates/xberg/src/extractors/pdf/ocr/plausibility.rs, crates/xberg/src/extractors/pdf/ocr/scoring.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/annotations.rs:937 β€” `bytes.len() >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF` appears character-identically in 7 files β€” crates/xberg-native-pdf/src/document/annotations.rs, crates/xberg-native-pdf/src/extractors/forms.rs, crates/xberg-native-pdf/src/extractors/page_labels.rs, crates/xberg-native-pdf/src/optional_content.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/document/annotations.rs:946 β€” `bytes.len() >= 2 && bytes[0] == 0xFF && bytes[1] == 0xFE` appears character-identically in 3 files β€” crates/xberg-native-pdf/src/document/annotations.rs, crates/xberg-native-pdf/src/optional_content.rs, crates/xberg-native-pdf/src/structure/parser.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/text/ner/gline.rs:341 β€” `categories.is_empty() && custom_labels.is_empty()` appears character-identically in 2 files β€” crates/xberg/src/text/ner/gline.rs, crates/xberg/src/text/ner/llm.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/extractors/text/advance.rs:208 β€” `ch >= '\x20' || ch == '\t' || ch == '\n' || ch == '\r'` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/extractors/text/advance.rs, crates/xberg-native-pdf/src/extractors/text/mod.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/text/ner/offsets.rs:52 β€” `character.is_alphanumeric() || character == '_'` appears character-identically in 2 files β€” crates/xberg/src/text/ner/offsets.rs, crates/xberg/src/text/redaction/engine.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg-native-pdf/src/extractors/text/advance.rs:759 β€” `chars.len() == buffer.char_widths.len() && !buffer.char_widths.is_empty()` appears character-identically in 2 files β€” crates/xberg-native-pdf/src/extractors/text/advance.rs, crates/xberg-native-pdf/src/extractors/text/tj_arrays.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/core/extractor/bytes.rs:84 β€” `config.extraction_timeout_secs.is_some() && config.cancel_token.is_none()` appears character-identically in 2 files β€” crates/xberg/src/core/extractor/bytes.rs, crates/xberg/src/core/extractor/file.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/core/extractor/bytes.rs:183 β€” `config.force_ocr && config.effective_disable_ocr()` appears character-identically in 2 files β€” crates/xberg/src/core/extractor/bytes.rs, crates/xberg/src/doctor/config_lint.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate crates/xberg/src/core/pipeline/mod.rs:472 β€” `config.runs_ocr_on_embedded_images() && !doc.images.is_empty()` appears character-identically in 4 files β€” crates/xberg/src/core/pipeline/mod.rs, crates/xberg/src/extractors/epub/mod.rs, crates/xberg/src/extractors/fictionbook.rs, crates/xberg/src/extractors/html.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X9 Β· Subsumed condition operand Β· Subsumed condition operand Β· Γ—25
  • Subsumed condition operand crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:993 β€” `clean_name.contains("URWBookmanL")` can never decide this `||` β€” every value satisfying `clean_name.contains("URWBookmanL")` also satisfies `clean_name.contains("Bookman")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-native-pdf/src/rendering/text_rasterizer.rs:997 β€” `clean_name.contains("URWChanceryL")` can never decide this `||` β€” every value satisfying `clean_name.contains("URWChanceryL")` also satisfies `clean_name.contains("Chancery")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-native-pdf/src/fonts/unicode_decode.rs:415 β€” `name.contains("KSCms")` can never decide this `||` β€” every value satisfying `name.contains("KSCms")` also satisfies `name.contains("KSC")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-cli/tests/commands_test.rs:299 β€” `stdout.contains("text/plain")` can never decide this `||` β€” every value satisfying `stdout.contains("text/plain")` also satisfies `stdout.contains("text")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-cli/tests/commands_test.rs:764 β€” `stderr.contains("Invalid chunk size")` can never decide this `||` β€” every value satisfying `stderr.contains("Invalid chunk size")` also satisfies `stderr.contains("chunk size")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-cli/tests/commands_test.rs:783 β€” `stderr.contains("Invalid chunk overlap")` can never decide this `||` β€” every value satisfying `stderr.contains("Invalid chunk overlap")` also satisfies `stderr.contains("overlap")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg-cli/tests/commands_test/part2.rs:199 β€” `stderr.contains("Output directory not found")` can never decide this `||` β€” every value satisfying `stderr.contains("Output directory not found")` also satisfies `stderr.contains("not found")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/archive_integration.rs:496 β€” `result.content.contains("ζ΅‹θ―•ζ–‡δ»Ά.txt")` can never decide this `||` β€” every value satisfying `result.content.contains("ζ΅‹θ―•ζ–‡δ»Ά.txt")` also satisfies `result.content.contains("txt")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/config_behavioral.rs:62 β€” `result.content.contains("**")` can never decide this `||` β€” every value satisfying `result.content.contains("**")` also satisfies `result.content.contains("*")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/jupyter_extractor_tests.rs:175 β€” `extraction.content.contains("dataclasses")` can never decide this `||` β€” every value satisfying `extraction.content.contains("dataclasses")` also satisfies `extraction.content.contains("dataclass")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/latex_extractor_tests.rs:239 β€” `result.content.contains("mc²")` can never decide this `||` β€” every value satisfying `result.content.contains("mc²")` also satisfies `result.content.contains("mc")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/markdown_extractor_tests.rs:208 β€” `result.content.contains("Additional markdown reader tests")` can never decide this `||` β€” every value satisfying `result.content.contains("Additional markdown reader tests")` also satisfies `result.content.contains("markdown")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/ocr_errors.rs:49 β€” `message.contains("language")` can never decide this `||` β€” every value satisfying `message.contains("language")` also satisfies `message.contains("lang")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:229 β€” `result.content.contains("**bold**")` can never decide this `||` β€” every value satisfying `result.content.contains("**bold**")` also satisfies `result.content.contains("bold")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:257 β€” `result.content.contains("*italic*")` can never decide this `||` β€” every value satisfying `result.content.contains("*italic*")` also satisfies `result.content.contains("italic")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:283 β€” `content.contains("striken")` can never decide this `||` β€” every value satisfying `content.contains("striken")` also satisfies `content.contains("strike")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:672 β€” `result.content.contains("First Section")` can never decide this `||` β€” every value satisfying `result.content.contains("First Section")` also satisfies `result.content.contains("First")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:676 β€” `result.content.contains("Second Section")` can never decide this `||` β€” every value satisfying `result.content.contains("Second Section")` also satisfies `result.content.contains("Second")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/odt_extractor_tests.rs:680 β€” `result.content.contains("Third Section")` can never decide this `||` β€” every value satisfying `result.content.contains("Third Section")` also satisfies `result.content.contains("Third")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/orgmode_extractor_tests.rs:192 β€” `result.content.contains("123")` can never decide this `||` β€” every value satisfying `result.content.contains("123")` also satisfies `result.content.contains("12")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/orgmode_extractor_tests.rs:463 β€” `result.content.contains("Café")` can never decide this `||` β€” every value satisfying `result.content.contains("Café")` also satisfies `result.content.contains("Caf")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/pdf_ocr_error_not_silence.rs:140 β€” `content.contains("native page one")` can never decide this `||` β€” every value satisfying `content.contains("native page one")` also satisfies `content.contains("native")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/pdf_output_quality.rs:135 β€” `content.contains("PDF backends")` can never decide this `||` β€” every value satisfying `content.contains("PDF backends")` also satisfies `content.contains("PDF backend")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/rst_extractor_tests.rs:61 β€” `result.content.contains("Level one header")` can never decide this `||` β€” every value satisfying `result.content.contains("Level one header")` also satisfies `result.content.contains("header")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand crates/xberg/tests/rst_extractor_tests.rs:181 β€” `result.content.contains("data Tree")` can never decide this `||` β€” every value satisfying `result.content.contains("data Tree")` also satisfies `result.content.contains("Tree")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
D31 Β· IaC & Container Security Β· Low IaC Β· Γ—8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 Β· Knowledge Freshness Β· Orphaned file Β· Γ—3
  • Orphaned file crates/xberg-gliner/src/candle/heads/count_lstm.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/xberg/src/transcription/tags.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/xberg-gliner/src/v2/splitter.rs:1 β€” No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
AX6 Β· Interface segregation Β· Fat interface Β· Γ—1
  • Fat interface: IOcrBackend (17 members) packages/csharp/src/Xberg/TraitBridges.cs:18 β€” `IOcrBackend` declares 17 members: `Name`, `Version`, `Initialize`, `Shutdown`, `ProcessImage`, `ProcessImageFile`, `SupportsLanguage`, `BackendType`, `SupportedLanguages`, `SupportedLanguagesFor`, `SupportsLanguageFor`, `SupportsTableDetection`, `SupportsDocumentProcessing`, `EmitsStructuredMarkdown`, `ConfidenceSemantics`, `PageOrientationHandling`, `ProcessDocument`. Counted as the author wrote them β€” a property is ONE member and its get/set accessors are not counted separately, and an event counts once. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
C4 Β· Data Retention Β· Partial data-retention evidence Β· Γ—1
  • Partial data-retention evidence β€” A retention mechanism is present, but the data-lifecycle is not yet complete β€” missing: a scheduled purge / cleanup job (PurgeOlderThan / CleanupJob), a documented retention period / data-expiry.
D20 Β· ADR Quality Β· No ADRs found Β· Γ—1
  • No ADRs found β€” No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these β€” unnumbered files outside any recognised directory, without those headings β€” is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 Β· Project Cohesion Β· Projects may be oversized for their cohesion Β· Γ—1
  • Projects may be oversized for their cohesion β€” 1 of 4 project(s) overshoot their size bounds, lowering Project Cohesion to 5.0/10. The most over is `Xberg` (42109 LoC, 431 public types across 1 namespaces). Review these for cohesion β€” split a project that spans unrelated responsibilities.
D28 Β· Secrets (history) Β· Rotate the exposed credentials Β· Γ—1
  • REDACTED
D30 Β· Dependency Vulnerabilities Β· Low vulnerability Β· Γ—1
  • REDACTED
D34 Β· Knowledge Freshness Β· Orphaned files with no living knowledge Β· Γ—1
  • Orphaned files with no living knowledge β€” 3 of 1315 analysed file(s) have no living knowledge left β€” their last meaningful change has decayed away, so if one breaks, no one currently understands it (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; 1315 of the 1537 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each β€” most significant first: crates/xberg-gliner/src/candle/heads/count_lstm.rs, crates/xberg/src/transcription/tags.rs, crates/xberg-gliner/src/v2/splitter.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 Β· Supply-chain Provenance & Signing Β· REDACTED Β· Γ—1
  • REDACTED
D40 Β· Network Egress Confinement Β· No network policy Β· Γ—1
  • No network policy β€” No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
M2 Β· Architecture documentation Β· No ADRs Β· Γ—1
  • No ADRs β€” No Architecture Decision Records found β€” no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P10 Β· Library API & versioning Β· Large public API surface Β· Γ—1
  • Large public API surface β€” 573/743 types (77%) are public. For a library, every public type is a stability contract β€” make internal-by-default and expose only the intended API.
PF2 Β· Allocation hygiene Β· No allocation-aware APIs detected Β· Γ—1
  • No allocation-aware APIs detected β€” No Span/Memory, pooling (ArrayPool/ObjectPool), stackalloc, ValueTask or buffer-writer usage was found. If this code sits on a hot path, these reduce the GC pressure it creates β€” a bonus, not a requirement.
X2 Β· Cancellation propagation Β· Not all async methods take a CancellationToken Β· Γ—1
  • Not all async methods take a CancellationToken β€” Only 0/6 async methods accept a CancellationToken, so in-flight work can't be stopped early when the caller gives up β€” whatever ends it in your host (shutdown signal, timeout, abandoned request, user cancel). Thread a token through the call chain and honour it at each await and loop; where a method genuinely cannot be interrupted, omitting it is a deliberate choice β€” judge against your hosting model.
X5 Β· Nullable reference types Β· Null-forgiving operator (`!`) suppressions reduce the NRT score Β· Γ—1
  • Null-forgiving operator (`!`) suppressions reduce the NRT score β€” ~1.5 `!` suppressions per 1k syntax nodes β€” 199 suppression(s) across the 135385 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide.
X7 Β· Silent fallback defaults Β· Silent fallback default on parse failure Β· Γ—1
  • Silent fallback default on parse failure tools/benchmark-harness/scripts/build_corpus.py:604 β€” `_language_sidecar` returns `{}` when `(json.JSONDecodeError, OSError)` is raised, with no log or raise β€” a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Minor β€” 1 finding(s)
D12 Β· Dependency Hygiene Β· Outdated Β· Γ—1
  • Outdated: rustler_precompiled β€” `:rustler_precompiled` is locked at 0.10.0 but 0.10.1 is the current stable release on hex.pm, and it already satisfies the `"~> 0.10"` requirement declared in packages/elixir/mix.exs β€” so the lockfile is behind this repository's own declared range. Run `mix deps.update rustler_precompiled` and commit the updated mix.lock.

Appendix B β€” Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 Β· Secrets (history)gitleaksβ€”gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-f1b767f8537241bfa08e636f218ac569/history.json --exit-code 0 --source .281artifacts/raw/gitleaks-history.json
D28 Β· Secrets (history)gitleaksβ€”gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-f1b767f8537241bfa08e636f218ac569/tree.json --exit-code 0 --source .26artifacts/raw/gitleaks-tree.json
D29 Β· Static Analysis (SAST)semgrepβ€”semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude crates/xberg-ffi --exclude crates/xberg-jni --exclude crates/xberg-node --exclude crates/xberg-php --exclude crates/xberg-py --exclude crates/xberg-wasm --exclude docs-site/src/snippets-generated/c/batch --exclude docs-site/src/snippets-generated/c/contract --exclude docs-site/src/snippets-generated/c/error --exclude docs-site/src/snippets-generated/c/format_specific --exclude docs-site/src/snippets-generated/c/ocr --exclude docs-site/src/snippets-generated/c/pdf --exclude docs-site/src/snippets-generated/c/plugin_api --exclude docs-site/src/snippets-generated/c/registry --exclude docs-site/src/snippets-generated/c/smoke --exclude docs-site/src/snippets-generated/c/url --exclude docs-site/src/snippets-generated/csharp/batch --exclude docs-site/src/snippets-generated/csharp/contract --exclude docs-site/src/snippets-generated/csharp/error --exclude docs-site/src/snippets-generated/csharp/format_specific --exclude docs-site/src/snippets-generated/csharp/ocr --exclude docs-site/src/snippets-generated/csharp/pdf --exclude docs-site/src/snippets-generated/csharp/plugin_api --exclude docs-site/src/snippets-generated/csharp/registry --exclude docs-site/src/snippets-generated/csharp/smoke --exclude docs-site/src/snippets-generated/csharp/url --exclude docs-site/src/snippets-generated/dart/batch --exclude docs-site/src/snippets-generated/dart/contract --exclude docs-site/src/snippets-generated/dart/error --exclude docs-site/src/snippets-generated/dart/format_specific --exclude docs-site/src/snippets-generated/dart/ocr --exclude docs-site/src/snippets-generated/dart/pdf --exclude docs-site/src/snippets-generated/dart/plugin_api --exclude docs-site/src/snippets-generated/dart/registry --exclude docs-site/src/snippets-generated/dart/smoke --exclude docs-site/src/snippets-generated/dart/url --exclude docs-site/src/snippets-generated/elixir/batch --exclude docs-site/src/snippets-generated/elixir/contract --exclude docs-site/src/snippets-generated/elixir/error --exclude docs-site/src/snippets-generated/elixir/format_specific --exclude docs-site/src/snippets-generated/elixir/ocr --exclude docs-site/src/snippets-generated/elixir/pdf --exclude docs-site/src/snippets-generated/elixir/plugin_api --exclude docs-site/src/snippets-generated/elixir/registry --exclude docs-site/src/snippets-generated/elixir/smoke --exclude docs-site/src/snippets-generated/elixir/url --exclude docs-site/src/snippets-generated/go/batch --exclude docs-site/src/snippets-generated/go/contract --exclude docs-site/src/snippets-generated/go/error --exclude docs-site/src/snippets-generated/go/format_specific --exclude docs-site/src/snippets-generated/go/ocr --exclude docs-site/src/snippets-generated/go/pdf --exclude docs-site/src/snippets-generated/go/plugin_api --exclude docs-site/src/snippets-generated/go/registry --exclude docs-site/src/snippets-generated/go/smoke --exclude docs-site/src/snippets-generated/go/url --exclude docs-site/src/snippets-generated/java/batch --exclude docs-site/src/snippets-generated/java/contract --exclude docs-site/src/snippets-generated/java/error --exclude docs-site/src/snippets-generated/java/format_specific --exclude docs-site/src/snippets-generated/java/ocr --exclude docs-site/src/snippets-generated/java/pdf --exclude docs-site/src/snippets-generated/java/plugin_api --exclude docs-site/src/snippets-generated/java/registry --exclude docs-site/src/snippets-generated/java/smoke --exclude docs-site/src/snippets-generated/java/url --exclude docs-site/src/snippets-generated/kotlin-android/batch --exclude docs-site/src/snippets-generated/kotlin-android/contract --exclude docs-site/src/snippets-generated/kotlin-android/error --exclude docs-site/src/snippets-generated/kotlin-android/format_specific --exclude docs-site/src/snippets-generated/kotlin-android/ocr --exclude docs-site/src/snippets-generated/kotlin-android/pdf --exclude docs-site/src/snippets-generated/kotlin-android/plugin_api --exclude docs-site/src/snippets-generated/kotlin-android/registry --exclude docs-site/src/snippets-generated/kotlin-android/smoke --exclude docs-site/src/snippets-generated/kotlin-android/url --exclude docs-site/src/snippets-generated/php/batch --exclude docs-site/src/snippets-generated/php/contract --exclude docs-site/src/snippets-generated/php/error --exclude docs-site/src/snippets-generated/php/format_specific --exclude docs-site/src/snippets-generated/php/ocr --exclude docs-site/src/snippets-generated/php/pdf --exclude docs-site/src/snippets-generated/php/plugin_api --exclude docs-site/src/snippets-generated/php/registry --exclude docs-site/src/snippets-generated/php/smoke --exclude docs-site/src/snippets-generated/php/url --exclude docs-site/src/snippets-generated/python/batch --exclude docs-site/src/snippets-generated/python/contract --exclude docs-site/src/snippets-generated/python/error --exclude docs-site/src/snippets-generated/python/format_specific --exclude docs-site/src/snippets-generated/python/ocr --exclude docs-site/src/snippets-generated/python/pdf --exclude docs-site/src/snippets-generated/python/plugin_api --exclude docs-site/src/snippets-generated/python/registry --exclude docs-site/src/snippets-generated/python/smoke --exclude docs-site/src/snippets-generated/python/url --exclude docs-site/src/snippets-generated/ruby/batch --exclude docs-site/src/snippets-generated/ruby/contract --exclude docs-site/src/snippets-generated/ruby/error --exclude docs-site/src/snippets-generated/ruby/format_specific --exclude docs-site/src/snippets-generated/ruby/ocr --exclude docs-site/src/snippets-generated/ruby/pdf --exclude docs-site/src/snippets-generated/ruby/plugin_api --exclude docs-site/src/snippets-generated/ruby/registry --exclude docs-site/src/snippets-generated/ruby/smoke --exclude docs-site/src/snippets-generated/ruby/url --exclude docs-site/src/snippets-generated/rust/batch --exclude docs-site/src/snippets-generated/rust/contract --exclude docs-site/src/snippets-generated/rust/error --exclude docs-site/src/snippets-generated/rust/format_specific --exclude docs-site/src/snippets-generated/rust/ocr --exclude docs-site/src/snippets-generated/rust/pdf --exclude docs-site/src/snippets-generated/rust/plugin_api --exclude docs-site/src/snippets-generated/rust/registry --exclude docs-site/src/snippets-generated/rust/smoke --exclude docs-site/src/snippets-generated/rust/url --exclude docs-site/src/snippets-generated/swift/batch --exclude docs-site/src/snippets-generated/swift/contract --exclude docs-site/src/snippets-generated/swift/error --exclude docs-site/src/snippets-generated/swift/format_specific --exclude docs-site/src/snippets-generated/swift/ocr --exclude docs-site/src/snippets-generated/swift/pdf --exclude docs-site/src/snippets-generated/swift/plugin_api --exclude docs-site/src/snippets-generated/swift/registry --exclude docs-site/src/snippets-generated/swift/smoke --exclude docs-site/src/snippets-generated/swift/url --exclude docs-site/src/snippets-generated/typescript/batch --exclude docs-site/src/snippets-generated/typescript/contract --exclude docs-site/src/snippets-generated/typescript/error --exclude docs-site/src/snippets-generated/typescript/format_specific --exclude docs-site/src/snippets-generated/typescript/ocr --exclude docs-site/src/snippets-generated/typescript/pdf --exclude docs-site/src/snippets-generated/typescript/plugin_api --exclude docs-site/src/snippets-generated/typescript/registry --exclude docs-site/src/snippets-generated/typescript/smoke --exclude docs-site/src/snippets-generated/typescript/url --exclude docs-site/src/snippets-generated/wasm/batch --exclude docs-site/src/snippets-generated/wasm/contract --exclude docs-site/src/snippets-generated/wasm/error --exclude docs-site/src/snippets-generated/wasm/format_specific --exclude docs-site/src/snippets-generated/wasm/ocr --exclude docs-site/src/snippets-generated/wasm/pdf --exclude docs-site/src/snippets-generated/wasm/plugin_api --exclude docs-site/src/snippets-generated/wasm/registry --exclude docs-site/src/snippets-generated/wasm/smoke --exclude docs-site/src/snippets-generated/wasm/url --exclude docs-site/src/snippets-generated/zig/batch --exclude docs-site/src/snippets-generated/zig/contract --exclude docs-site/src/snippets-generated/zig/error --exclude docs-site/src/snippets-generated/zig/format_specific --exclude docs-site/src/snippets-generated/zig/ocr --exclude docs-site/src/snippets-generated/zig/pdf --exclude docs-site/src/snippets-generated/zig/plugin_api --exclude docs-site/src/snippets-generated/zig/registry --exclude docs-site/src/snippets-generated/zig/smoke --exclude docs-site/src/snippets-generated/zig/url --exclude e2e --exclude packages/csharp/src --exclude packages/dart --exclude packages/elixir --exclude packages/go --exclude packages/java --exclude packages/kotlin-android --exclude packages/python --exclude packages/ruby --exclude packages/swift --exclude packages/zig --exclude plugin/.cursor-plugin/skills/xberg/references --exclude plugin/.cursor-plugin/skills/xberg-batch-extraction/references --exclude plugin/.cursor-plugin/skills/xberg-chunking/references --exclude plugin/.cursor-plugin/skills/xberg-extracting-keywords/references --exclude plugin/.cursor-plugin/skills/xberg-extracting-tables/references --exclude plugin/.cursor-plugin/skills/xberg-extracting-with-ocr/references --exclude plugin/.cursor-plugin/skills/xberg-picking-a-format/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-batch-extraction/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-chunking/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-extracting-keywords/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-extracting-tables/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-extracting-with-ocr/references --exclude plugin/.hermes/package/src/xberg_hermes_plugin/skills/xberg-picking-a-format/references --exclude plugin/.hermes/plugins/xberg/skills/xberg/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-batch-extraction/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-chunking/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-extracting-keywords/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-extracting-tables/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-extracting-with-ocr/references --exclude plugin/.hermes/plugins/xberg/skills/xberg-picking-a-format/references --exclude plugin/.opencode/plugins --exclude plugin/.opencode/skills/xberg/references --exclude plugin/.opencode/skills/xberg-batch-extraction/references --exclude plugin/.opencode/skills/xberg-chunking/references --exclude plugin/.opencode/skills/xberg-extracting-keywords/references --exclude plugin/.opencode/skills/xberg-extracting-tables/references --exclude plugin/.opencode/skills/xberg-extracting-with-ocr/references --exclude plugin/.opencode/skills/xberg-picking-a-format/references --exclude plugin/.pi/skills/xberg/references --exclude plugin/.pi/skills/xberg-batch-extraction/references --exclude plugin/.pi/skills/xberg-chunking/references --exclude plugin/.pi/skills/xberg-extracting-keywords/references --exclude plugin/.pi/skills/xberg-extracting-tables/references --exclude plugin/.pi/skills/xberg-extracting-with-ocr/references --exclude plugin/.pi/skills/xberg-picking-a-format/references --exclude plugin/skills/xberg/references --exclude plugin/skills/xberg-batch-extraction/references --exclude plugin/skills/xberg-chunking/references --exclude plugin/skills/xberg-extracting-keywords/references --exclude plugin/skills/xberg-extracting-tables/references --exclude plugin/skills/xberg-extracting-with-ocr/references --exclude plugin/skills/xberg-picking-a-format/references --exclude skills/xberg/references --exclude skills/xberg-batch-extraction/references --exclude skills/xberg-chunking/references --exclude skills/xberg-extracting-keywords/references --exclude skills/xberg-extracting-tables/references --exclude skills/xberg-extracting-with-ocr/references --exclude skills/xberg-picking-a-format/references .745artifacts/raw/semgrep.json
D30 Β· Dependency Vulnerabilitiestrivyβ€”trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update25artifacts/raw/trivy-fs.json
D31 Β· IaC & Container Securitytrivyβ€”trivy config --format json --quiet .47artifacts/raw/trivy-config.json
D32 Β· Data Compliance (PII/GDPR)semgrepβ€”semgrep: not applicable β€” No personal data was found crossing a boundary the PII/GDPR ruleset checks β€” nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0β€”
D42 Β· Runtime Threat Enforcementruntime-hardeningβ€”runtime-hardening: not applicable β€” The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart β€” nothing for this repo to assess.0β€”
D43 Β· Malicious Dependenciestrivyβ€”trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a17c2d-c574-7cee-91aa-9ed58b064e9a Β· every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Appendix C β€” Personal-data map

Every field, property and record parameter whose name is conventional personal data β€” 11 field(s) across 2 categories, each with an exact repo-relative file:line. This is the data inventory a compliance review starts from β€” right-to-erasure, retention, minimisation. Detected by NAME, from the C# syntax tree, with a deliberately specific identifier classifier β€” the same one the C1–C5 compliance cards use to decide whether personal data is present, so CardDefinition or FileName don't trip. Two caveats stated rather than glossed: those cards additionally require corroboration (a persistence/account signal, or two distinct PII categories) that this inventory deliberately does not, so it lists more than they gate on; and D32 Data Compliance shares nothing with it β€” that dimension is a separate semgrep ruleset for personal data leaking into logs, URLs and browser storage, and a clean D32 result says nothing about this list. Informational β€” it feeds no score.

Email β€” 10 field(s)
  • EmailExtractionResult.FromEmail packages/csharp/src/Xberg/EmailExtractionResult.cs:32
  • EmailExtractionResult.ToEmails packages/csharp/src/Xberg/EmailExtractionResult.cs:38
  • EmailExtractionResult.CcEmails packages/csharp/src/Xberg/EmailExtractionResult.cs:44
  • EmailExtractionResult.BccEmails packages/csharp/src/Xberg/EmailExtractionResult.cs:50
  • EmailMetadata.FromEmail packages/csharp/src/Xberg/EmailMetadata.cs:25
  • EmailMetadata.ToEmails packages/csharp/src/Xberg/EmailMetadata.cs:37
  • EmailMetadata.CcEmails packages/csharp/src/Xberg/EmailMetadata.cs:43
  • EmailMetadata.BccEmails packages/csharp/src/Xberg/EmailMetadata.cs:49
  • ExtractionConfig.Email packages/csharp/src/Xberg/ExtractionConfig.cs:473
  • FormatMetadata.AsEmail packages/csharp/src/Xberg/FormatMetadata.cs:191
Name β€” 1 field(s)
  • PdfFormField.FullName packages/csharp/src/Xberg/PdfFormField.cs:35

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric β€” drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

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