Public report of PaddlePaddle/PaddleOCR, published 25 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, 25 October 2026, 00:37 UTC · Survey ID cd_c1b58b460f104845b7ce056784451d4e

PaddlePaddle/PaddleOCR

Measured 25 October 2026, 00:33 UTC, at code version dab3fe3

No regression since the last survey

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.

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

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

A large codebase: 116,801 lines of product code in 13 projects, tests not counted · Estimated rebuild effort: about 0.8 person-years · Weakest lens: Security and Compliance, 33

Findings by how serious they are

431 critical 1016 serious 462 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
25 October 2026, 00:33 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 ▸

79of 82 dimensions measured by tools. The other 3 are advisory notes from an AI model, which explain the code but don't count towards the score.
1893of 1909 findings point to an exact file and line, so you can open each one in the code. The other 16 concern the repository as a whole, such as missing documentation.
82dimensions across 6 lenses, read from 116,801 lines of product code in 13 projects.
Chapters

Executive summary

PaddlePaddle/PaddleOCR scores 51 out of 100, but it is rated At risk while a critical security finding is open; the score itself is unchanged.

The weakest lens counts most in the score, and here that is Security and Compliance, which scores 33 and is rated Weak. Its Static Analysis (SAST) dimension scores 0 out of 10, and until that reaches 4, Security and Compliance can't be rated higher than Adequate. The first actions are to protect endpoints by default-deny: a global authentication guard or middleware with explicit public opt-outs, or a guard on every route, plus named role/permission rules for what an authenticated caller may do and to resolve the 66 Medium IaC finding(s) in IaC & Container Security, and if Security and Compliance rose to 70, the score would rise from 51 to about 66.

431 findings are critical: 388 in Static Analysis (SAST), 26 in Dependency Vulnerabilities and 17 in IaC & Container Security.

Watchdog couldn't measure 7 dimensions in this code, among them Code Coverage, Internal API Consistency and Navigability, so they are left out of the score. The product code is 116,801 lines, which would take an estimated 0.8 person-years, around €120,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 33 · counts for 46%Production Readiness 57 · counts for 25%Code Health 71 · counts for 14%Maturity 73 · counts for 8%Performance 83 · counts for 4%Architecture 95 · counts for 2%

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

Code composition: what the lines of code are
Product code 92%Tests 8%
New since the last survey: 19 findings

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

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

Fixed since the last survey: 31 findings

These 31 critical or serious findings were in the previous survey, on 11 October 2026, and are gone from this one.

  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · High CVE: [GHSA redacted] REDACTED
  • Dependency Vulnerabilities · Medium CVE: REDACTED REDACTED
  • Dependency Vulnerabilities · Medium CVE: REDACTED REDACTED
  • Supply-chain Provenance & Signing REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (empty catch) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (empty catch) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (empty catch) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (empty catch) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (empty catch) paddleocr/_doc2md/converters/docx.py
  • Exception handling · Swallowed exception (caught, then discarded) paddleocr/_doc2md/math/__init__.py
  • Exception handling · Swallowed exception (empty catch) REDACTED
  • Exception handling · Swallowed exception (empty catch) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) ppocr/data/pgnet_dataset.py
  • Exception handling · Swallowed exception (caught, then discarded) ppocr/data/imaug/random_crop_data.py
  • Exception handling · Swallowed exception (caught, then discarded) ppocr/data/imaug/make_pse_gt.py
  • Exception handling · Swallowed exception (empty catch) ppocr/data/imaug/fce_aug.py
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) ppocr/postprocess/rec_postprocess.py
  • Exception handling · Swallowed exception (empty catch) tools/train.py
  • Exception handling · Swallowed exception (empty catch) tools/program.py
  • Exception handling · Swallowed exception (caught, then discarded) tools/program.py
  • Async & latency hygiene · Sync-over-async blocking api_sdk/typescript/src/internal/http.ts
Rebuild cost: about €120,000 · Estimate
Cost to rebuild€40,000 to €200,000, for 668 to 2,118 hours of work, about 0.8 person-years for 1 to 2 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.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.
SizeLarge: 116,801 lines of product code

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

Top priorities

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

1
Protect endpoints by default-deny: a global authentication guard or middleware with explicit public opt-outs, or a guard on every route, plus named role/permission rules for what an authenticated caller may do.
Raises the score by about 14 points · Medium effort · Access Controls
2
Resolve the 66 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (30), REDACTED (30), REDACTED (4).
Raises the score by about 4 points · Medium effort · IaC & Container Security
3
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED.
Raises the score by about 2 points · Low effort · Supply-chain Provenance & Signing

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 €120,000 to build again, about 0.8 person-years of work. Its weakest lens is Security and Compliance, at 33 (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
Protect endpoints by default-deny: a global authentication guard or middleware with explicit public opt-outs, or a guard on every route, plus named role/permission rules for what an authenticated caller may do. Of all the actions in this report, it raises the score most for the work it takes: about 14 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.9 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 2,937 lines over the last 90 days, which is about 11,911 lines a year. At that pace, the extra work comes to an estimated 0.8 to 5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of 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; 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 — a layering smell or cycle. A clean layered graph has none.

arch @paddleocr/api-sdk api-sdk @paddleocr/paddleocr-js paddleocr-js github.com/PaddlePaddle/PaddleOCR/api_sdk/go go langchain-paddleocr langchain-paddleocr paddleocr paddleocr paddleocr_mcp paddleocr_mcp ppocr-android ppocr-android ppocr-android:app ppocr-android:app ppocr-android:ppocr-sdk ppocr-android:ppocr-sdk ppocr-android:app->ppocr-android:ppocr-sdk

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.

513 modules, with 176 dependencies between them. 2 loops run through 4 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 473 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 api_sdk.typescript.src.internal.http2 api_sdk.typescript.src.results3 com.paddle.ocr.model4 mcp_server.paddleocr_mcp.inference.shared.input_adapters5 mcp_server.paddleocr_mcp.inference.types6 paddleocr-js.packages.core.src.runtime.ort7 paddleocr-js.packages.core.src.viz.ocr.types8 paddleocr._api_client.models9 paddleocr._api_client.results10 paddleocr._doc2md.base11 paddleocr._models.base12 paddleocr._pipelines.base13 ppocr.losses.distillation_loss14 api_sdk.typescript.src.internal.poller15 com.paddle.ocr.demo.OCRApplication16 com.paddle.ocr.engine17 mcp_server.paddleocr_mcp.inference.base18 mcp_server.paddleocr_mcp.inference.shared19 paddleocr-js.packages.core.src.models.det20 paddleocr-js.packages.core.src.models.rec21 paddleocr._models._image_classification22 api_sdk.typescript.src.client23 com.paddle.ocr24 com.paddle.ocr.demo.ui.viewmodel25 mcp_server.paddleocr_mcp.inference.ocr.aistudio26 mcp_server.paddleocr_mcp.inference.ocr.local27 mcp_server.paddleocr_mcp.inference.paddleocr_vl.aistudio28 mcp_server.paddleocr_mcp.inference.paddleocr_vl.local29 mcp_server.paddleocr_mcp.inference.pp_structurev3.aistudio30 mcp_server.paddleocr_mcp.inference.pp_structurev3.local31 mcp_server.paddleocr_mcp.inference.shared.http_base32 mcp_server.paddleocr_mcp.tasks.base33 paddleocr-js.packages.core.src.models34 paddleocr-js.packages.core.src.pipelines.ocr.config35 paddleocr-js.packages.core.src.pipelines.ocr.runtime-params36 com.paddle.ocr.demo37 paddleocr-js.packages.core.src.pipelines.ocr.core38 paddleocr-js.packages.core.src.pipelines.ocr.worker-backed39 paddleocr-js.packages.core.src.viz.ocr40 paddleocr-js.packages.core.src.pipelines.ocr
1 api_sdk.typescript.src.internal.http
2 api_sdk.typescript.src.results
3 com.paddle.ocr.model
4 mcp_server.paddleocr_mcp.inference.shared.input_adapters
5 mcp_server.paddleocr_mcp.inference.types
6 paddleocr-js.packages.core.src.runtime.ort
7 paddleocr-js.packages.core.src.viz.ocr.types
8 paddleocr._api_client.models
9 paddleocr._api_client.results
10 paddleocr._doc2md.base
11 paddleocr._models.base
12 paddleocr._pipelines.base
13 ppocr.losses.distillation_loss
14 api_sdk.typescript.src.internal.poller12
15 com.paddle.ocr.demo.OCRApplication1
16 com.paddle.ocr.engine14
17 mcp_server.paddleocr_mcp.inference.base11
18 mcp_server.paddleocr_mcp.inference.shared3
19 paddleocr-js.packages.core.src.models.det1
20 paddleocr-js.packages.core.src.models.rec1
21 paddleocr._models._image_classification2
22 api_sdk.typescript.src.client151
23 com.paddle.ocr12
24 com.paddle.ocr.demo.ui.viewmodel11
25 mcp_server.paddleocr_mcp.inference.ocr.aistudio121
26 mcp_server.paddleocr_mcp.inference.ocr.local121
27 mcp_server.paddleocr_mcp.inference.paddleocr_vl.aistudio121
28 mcp_server.paddleocr_mcp.inference.paddleocr_vl.local121
29 mcp_server.paddleocr_mcp.inference.pp_structurev3.aistudio121
30 mcp_server.paddleocr_mcp.inference.pp_structurev3.local121
31 mcp_server.paddleocr_mcp.inference.shared.http_base111
32 mcp_server.paddleocr_mcp.tasks.base1
33 paddleocr-js.packages.core.src.models494
34 paddleocr-js.packages.core.src.pipelines.ocr.config1
35 paddleocr-js.packages.core.src.pipelines.ocr.runtime-params31
36 com.paddle.ocr.demo11
37 paddleocr-js.packages.core.src.pipelines.ocr.core122
38 paddleocr-js.packages.core.src.pipelines.ocr.worker-backed22
39 paddleocr-js.packages.core.src.viz.ocr32
40 paddleocr-js.packages.core.src.pipelines.ocr215431
Uses a module listed above itPart of a loopThe module itself
1 api_sdk.typescript.src.internal.http2 api_sdk.typescript.src.results3 com.paddle.ocr.model4 mcp_server.paddleocr_mcp.inference.shared.input_adapters5 mcp_server.paddleocr_mcp.inference.types6 paddleocr-js.packages.core.src.runtime.ort7 paddleocr-js.packages.core.src.viz.ocr.types8 paddleocr._api_client.models9 paddleocr._api_client.results10 paddleocr._doc2md.base11 paddleocr._models.base12 paddleocr._pipelines.base13 ppocr.losses.distillation_loss14 api_sdk.typescript.src.internal.poller15 com.paddle.ocr.demo.OCRApplication16 com.paddle.ocr.engine17 mcp_server.paddleocr_mcp.inference.base18 mcp_server.paddleocr_mcp.inference.shared19 paddleocr-js.packages.core.src.models.det20 paddleocr-js.packages.core.src.models.rec21 paddleocr._models._image_classification22 api_sdk.typescript.src.client23 com.paddle.ocr24 com.paddle.ocr.demo.ui.viewmodel25 mcp_server.paddleocr_mcp.inference.ocr.aistudio26 mcp_server.paddleocr_mcp.inference.ocr.local27 mcp_server.paddleocr_mcp.inference.paddleocr_vl.aistudio28 mcp_server.paddleocr_mcp.inference.paddleocr_vl.local29 mcp_server.paddleocr_mcp.inference.pp_structurev3.aistudio30 mcp_server.paddleocr_mcp.inference.pp_structurev3.local31 mcp_server.paddleocr_mcp.inference.shared.http_base32 mcp_server.paddleocr_mcp.tasks.base33 paddleocr-js.packages.core.src.models34 paddleocr-js.packages.core.src.pipelines.ocr.config35 paddleocr-js.packages.core.src.pipelines.ocr.runtime-params36 com.paddle.ocr.demo37 paddleocr-js.packages.core.src.pipelines.ocr.core38 paddleocr-js.packages.core.src.pipelines.ocr.worker-backed39 paddleocr-js.packages.core.src.viz.ocr40 paddleocr-js.packages.core.src.pipelines.ocrapi_sdk.typescript.src.internal.http1api_sdk.typescript.src.results2com.paddle.ocr.model3mcp_server.paddleocr_mcp.inference.shared.input_adapters4mcp_server.paddleocr_mcp.inference.types5paddleocr-js.packages.core.src.runtime.ort6paddleocr-js.packages.core.src.viz.ocr.types7paddleocr._api_client.models8paddleocr._api_client.results9paddleocr._doc2md.base10paddleocr._models.base11paddleocr._pipelines.base12ppocr.losses.distillation_loss13api_sdk.typescript.src.internal.poller14com.paddle.ocr.demo.OCRApplication15com.paddle.ocr.engine16mcp_server.paddleocr_mcp.inference.base17mcp_server.paddleocr_mcp.inference.shared18paddleocr-js.packages.core.src.models.det19paddleocr-js.packages.core.src.models.rec20paddleocr._models._image_classification21api_sdk.typescript.src.client22com.paddle.ocr23com.paddle.ocr.demo.ui.viewmodel24mcp_server.paddleocr_mcp.inference.ocr.aistudio25mcp_server.paddleocr_mcp.inference.ocr.local26mcp_server.paddleocr_mcp.inference.paddleocr_vl.aistudio27mcp_server.paddleocr_mcp.inference.paddleocr_vl.local28mcp_server.paddleocr_mcp.inference.pp_structurev3.aistudio29mcp_server.paddleocr_mcp.inference.pp_structurev3.local30mcp_server.paddleocr_mcp.inference.shared.http_base31mcp_server.paddleocr_mcp.tasks.base32paddleocr-js.packages.core.src.models33paddleocr-js.packages.core.src.pipelines.ocr.config34paddleocr-js.packages.core.src.pipelines.ocr.runtime-params35com.paddle.ocr.demo36paddleocr-js.packages.core.src.pipelines.ocr.core37paddleocr-js.packages.core.src.pipelines.ocr.worker-backed38paddleocr-js.packages.core.src.viz.ocr39paddleocr-js.packages.core.src.pipelines.ocr401211411311215112111211211211211211211111494131111222232215431+473 more modules (most-connected shown)

At a glance — Code Health · 71% · Adequate · gated by D2 ·

At a glance — Architecture · 95% · Exemplary ·

At a glance — Maturity · 73% · Adequate · gated by D34 ·

At a glance — Readiness · 57% · Adequate · gated by P3, P7 ·

At a glance — Security · 33% · Weak · gated by D29, D30, D31, D36, C2 ·

At a glance — Performance · 83% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection407High / Critical
A02:2025 — Security Misconfiguration101High / Critical
A03:2025 — Software Supply Chain Failures47High / Critical

Roadmap

First, implement a global authentication guard with explicit public opt-outs and named role rules to enforce default-deny access controls. Next, resolve the 293 static analysis findings in shell scripts, the 66 medium IaC issues in Dockerfiles, and the 18 high dependency vulnerabilities to harden the codebase. Finally, integrate a SAST step into the CI pipeline to automatically fail builds on security regressions.

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

Do thisHelpsEffortDimension
Protect endpoints by default-deny: a global authentication guard or middleware with explicit public opt-outs, or a guard on every route, plus named role/permission rules for what an authenticated caller may do.+14.0 ptsMediumAccess Controls
Resolve the 66 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (30), REDACTED (30), REDACTED (4).+4.3 ptsMediumIaC & Container Security
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED.+1.9 ptsLowSupply-chain Provenance & Signing
Resolve the 18 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (12), REDACTED (6).+3.0 ptsMediumDependency Vulnerabilities
Resolve the 1 No ADRs found finding(s) in ADR Quality.+1.4 ptsLowADR Quality
Resolve the 2 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2).+1.3 ptsLowDependency Vulnerabilities
Resolve the 5 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2).+1.3 ptsLowDependency Vulnerabilities
Resolve the 293 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (282), REDACTED (4), REDACTED (3).+5.1 ptsHighStatic Analysis (SAST)

File quality

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

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.9SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.9SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.5SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.2MixedStatic 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 — 431

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

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

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

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

What we checked — 82 dimensions across the health lenses
D1D2D3D4D5D6D9D10D11D12D13D14D15D16D17D19D20D21D26D28D29D30D31D34D35D36D43D44AX10AX3AX4AX6AX9C2M1M2M3M4P1P10P2P3P4P6P7PF2PF3R1R10R2R3R4R5R6R7R8R9S1X1X12X13X14X15X16X17X18X19X2X20X21X22X23X24X25X26X27X28X29X3X30X4X5

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, 1893 of 1909 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 measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a1707a-0f09-7fa0-93eb-e8e7a53d353e.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — 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. Coverage NOT MEASURED: this repository's production source spans .ts, .py, and our analyzer cannot run the .py test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 90.7% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or `coverage run -m pytest` then `coverage xml`) 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 and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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 — then both halves are read on the next scan.
  • 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 219 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 53 test source file(s) (.py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • 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 pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its JVM 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 package.json, but the licence verdict published here was taken over its JVM 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.
  • D22 Internal API Consistency — LLM provider failed — The model provider returned an unusable result, so this LLM-assisted dimension fell back to a measurement gap (confidence 0) rather than a penalty. Re-run with a reachable provider to score it.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `deploy/ios_demo/PaddleOCRDemo/Engine/OCRParameterResolver.swift`, `deploy/ppocr-android/app/src/main/java/com/paddle/ocr/demo/ui/viewmodel/OCRViewModel.kt`, `paddleocr-js/packages/core/src/runtime/ort.ts` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • 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. Boot via AndroidApp (deploy/ppocr-android/app). the Android app did not build — `./gradlew :app:assembleDebug` exited 1: ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation.; runtime evidence skipped (launch chosen because deploy/ppocr-android/app/build.gradle.kts applies the Android application plugin and deploy/ppocr-android/gradlew builds it).
  • C1 Data Protection — 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. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Go, Kotlin, Python, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Go, Kotlin, Python, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 90 further occurrence(s) are not listed individually; the score already reflects all 130.
  • 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. 19 further occurrence(s) are not listed individually; the score already reflects all 59.

Repo exclusion declarations: 5 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.
  • D11 Test Reliability: Flakiness is inferred from history/markers — Watchdog runs the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • 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.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

D1 · Cyclomatic Complexity6.3 / 10Adequate✓ Tool-verified

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

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

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

74 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was program.train at 79.

program.train (cyclomatic 79)tools/program.py:200
utility.create_predictor (cyclomatic 60)tools/infer/utility.py:177
CustomMBartDecoder.forward (cyclomatic 55)ppocr/modeling/heads/rec_unimernet_head.py:1663
docx._extract_chart_tables (cyclomatic 53)paddleocr/_doc2md/converters/docx.py:967
CustomMBartDecoder.forward (cyclomatic 53)ppocr/modeling/heads/rec_ppformulanet_head.py:412

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

What to do

  1. Bring the 1 body over 60 down to 60 or less in Cyclomatic Complexity — start with program.train (cyclomatic 79). — Refactoring it lifts Cyclomatic Complexity from 6.3 to about 6.5/10.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity3.3 / 10Weak✓ Tool-verified

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

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

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

174 method(s) exceeded the cognitive complexity threshold of 15; the worst was program.train at 173.

DistillationKLDivLoss.forward (cognitive 31) · ×2ppocr/losses/distillation_loss.py:197
DistillationDKDLoss.forward (cognitive 31) · ×2ppocr/losses/distillation_loss.py:305
program.train (cognitive 173)tools/program.py:200
docx._extract_chart_tables (cognitive 163)paddleocr/_doc2md/converters/docx.py:967
XlsxConverter.convert_file (cognitive 138)paddleocr/_doc2md/converters/xlsx.py:162

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

What to do

  1. Bring the 4 bodies over 120 down to 120 or less in Cognitive Complexity — start with program.train (cognitive 173), docx._extract_chart_tables (cognitive 163), XlsxConverter.convert_file (cognitive 138). — 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 4 together lifts Cognitive Complexity from 3.3 to about 4.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes8.9 / 10Strong✓ Tool-verified

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

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

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

28 god class(es) detected.

FileTooLong: heads/rec_unimernet_head.py · ×26ppocr/modeling/heads/rec_unimernet_head.py
TooManyFields: PPStructureV3Options · ×2api_sdk/go/models.go:66

What to do

  1. Resolve the 26 FileTooLong finding(s) in God Classes — start with rec_unimernet_head.py, REDACTED, docx.py. — One of this dimension's main actionable groups (26 warning-level).
  2. Resolve the 2 TooManyFields finding(s) in God Classes — start with models.go (2). — One of this dimension's main actionable groups (2 warning-level).
  3. 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 Duplication7.9 / 10Strong✓ 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 7.9 / 10 · rule-coverage 100% · ceiling Verified

488 duplicated block group(s) detected. A further 49 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 63 of the 537 are in trees this repository does not ship — vendored, example/demo, 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 (8 lines × 2) · ×27ppocr/data/collate_fn.py:51
Duplicated block (5 lines × 2) · ×22ppocr/data/imaug/latex_ocr_aug.py:104
Duplicated block (6 lines × 2) · ×20ppocr/data/imaug/fce_targets.py:612
Duplicated block (7 lines × 2) · ×19paddleocr/_doc2md/converters/docx.py:1015
Duplicated block (10 lines × 2) · ×17mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:120

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

What to do

  1. Resolve the 27 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with extract_textpoint_fast.py (2), collate_fn.py, abinet_aug.py. — One of this dimension's main actionable groups (27 warning-level).
  2. Resolve the 22 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with pg_process.py (2), fce_aug.py (2), latex_ocr_aug.py. — One of this dimension's main actionable groups (22 warning-level).
  3. Resolve the 20 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with utility.py (3), ocr.go (2), fce_targets.py. — One of this dimension's main actionable groups (20 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 · Coupling9.1 / 10Stronggated by 1 serious finding✓ 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 9.1 / 10 · rule-coverage 100% · ceiling Prevented

9 production modules (Gradle+npm+Go+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 1 module(s) off the main sequence, with abstractness counted on 8 of the 9 (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: ppocr-android:ppocr-sdk

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 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)10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

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

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

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

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

1 of 307 classes have LCOM4 above 3.

Low cohesion: InferenceEngine (LCOM4 4)benchmark/PaddleOCR_DBNet/tools/infer.py:35

What to do

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

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

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

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

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

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

370 test methods: 370 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 219 `it`/`test` case(s) across 35 test file(s) declaring at least one beside 11 .NET test method(s); its tier split is read from package names and paths only. The Python suite contributes 135 test function(s) across 38 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 5 test case(s) across 1 `_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: 0 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.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality9.9 / 10Stronggated by 1 serious finding✓ 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.9 / 10 · rule-coverage 100% · ceiling Prevented

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

No assertions: dispose() is safe to call multiple timespaddleocr-js/packages/core/test/viz-renderer.test.ts:44
Mock-dominated test: predicts multiple sources when input is an array · ×2paddleocr-js/packages/core/test/worker-backed.test.ts:143

What to do

  1. Resolve the 2 Mock-dominated test finding(s) in Test Quality — start with worker-backed.test.ts, rec-model.test.ts. — One of this dimension's main actionable groups (2 recommendation-level).
  2. Resolve the 1 No assertions finding(s) in Test Quality — start with viz-renderer.test.ts. — One of this dimension's main actionable groups (1 warning-level).
  3. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

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

0 flaky across 2 measured tier(s). JavaScript/TypeScript (vitest via `npm ci --ignore-scripts` in api_sdk/typescript/ (41 tests); vitest via `npm ci --ignore-scripts` in paddleocr-js/ (185 tests)): measured (0 flaky); Python (2 distributions): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.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 direct SwiftPM dependencies, 0 pinning defect(s). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question. 3 third-party CocoaPods resolved by a committed Podfile.lock were graded against the CocoaPods trunk (cdn.cocoapods.org): a pod is behind only when the trunk lists a newer release on the same major, which `pod update` reaches under a `~>` requirement. A pod sourced from a path, git URL or local podspec has no trunk release to compare and is not asked about. Carthage dependencies are not graded.

Outdated: onnxruntime-objc

✓ On the Gold path — maintain.

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

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

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

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

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

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 6 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 6 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. 5 further coordinate(s) are declared with no version at the declaration site — inherited from a parent POM, a BOM or an unresolved Gradle version reference — and are NOT graded: this verdict covers what the checkout pins, not the full transitive graph. A further 10 coordinate(s) are not published to Maven Central — another repository (Google's Maven hosts androidx), a SNAPSHOT, or a private artifact — so their licences are not readable from here and they are outside this verdict. ★ COVERAGE OF THIS VERDICT: it grades this repository's JVM dependencies and nothing else. The repository also declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry) 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 Hotspots10.0 / 10Exemplary✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

No churn × complexity hotspots in the window.

✓ On the Gold path — maintain.

Detailed fixes: d15_recommendation.md.

D16 · Bus Factor9.9 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

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

3 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is paddleocr/_doc2md/converters/docx.py. Counted over 432 of the 675 production source files in this repository: 241 are under the ~2,400-byte size floor this dimension measures over, and the remaining 2 have no attributable history left to measure.

Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

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

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

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

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

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

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

TodoComment · ×27paddleocr/_cli.py:127
HackComment · ×2paddleocr/_pipelines/pp_doctranslation.py:323
FixmeComment · ×2paddleocr/_pipelines/pp_doctranslation.py:902
XxxComment · ×2REDACTED:71

What to do

  1. Resolve the 27 TodoComment finding(s) in Explicit Debt — start with REDACTED (3), test_formula_recognition.py (3), collate_fn.py (2). — One of this dimension's main actionable groups (27 warning-level).
  2. Resolve the 2 HackComment finding(s) in Explicit Debt — start with pp_doctranslation.py, utility.py. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 FixmeComment finding(s) in Explicit Debt — start with pp_doctranslation.py, pp_chatocrv4_doc.py. — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation QualityStrong◐ Sampled · advisory

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

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

The repository's root README is a global overview of PaddleOCR covering its name, multilingual support, major releases (PaddleOCR-VL, PP-StructureV3), and the API SDKs it exposes. It also links to architecture/Docs markdown files for detailed docs on deployment options, benchmarking, and model-specific upgrade considerations. The READMEs for each directory (api_sdk/, applications/, deploy/, langchain-paddleocr/) document only that directory rather than the repository as a whole, so they are not flagged by the per-document rules but do show the project's breadth. (11 of 25 sampled documents could not be assessed: 1 of 2 evaluation groups failed.)

What to do

  1. Improve Documentation Quality — currently 8.0/10. — The repository's root README is a global overview of PaddleOCR covering its name, multilingual support, major releases (PaddleOCR-VL, PP-StructureV3), and the API SDKs it exposes. It also links to architecture/Docs markdown files for detailed docs on deployment options, benchmarking, and model-specific upgrade considerations. The READMEs for each directory (api_sdk/, applications/, deploy/, langchain-paddleocr/) document only that directory rather than the repository as a whole, so they are not flagged by the per-document rules but do show the project's breadth. (11 of 25 sampled documents could not be assessed: 1 of 2 evaluation groups failed.)

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

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

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

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

No architecture decision records were found.

No ADRs found

What to do

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

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

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

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

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D26 · Project Cohesion8.5 / 10Strong✓ Tool-verified

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

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

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

1 of 13 build units (Go, Gradle, Python, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)0.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

407 finding(s): 0 critical, 388 high, 15 medium, 4 low. 26 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 6 file(s) — `deploy/cpp_infer/src/pipelines/ocr/result.h` (line 26), `deploy/ios_demo/scripts/run_benchmark.sh` (line 787), `deploy/paddleocr_vl_docker/build_pipeline.sh` (line 206), `deploy/paddleocr_vl_docker/build_vlm.sh` (line 226), `REDACTED` (lines 1–4, line 8), … (+1 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 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

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

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

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

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

40 finding(s): 6 critical, 20 high, 12 medium, 2 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 18 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (12), REDACTED (6). — One of this dimension's main actionable groups (18 issue-level).
  2. Resolve the 5 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (5 issue-level).
  3. Resolve the 2 High 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 Security0.0 / 10Critical✓ Tool-verified

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

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

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

101 finding(s): 0 critical, 17 high, 66 medium, 18 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 66 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (30), REDACTED (30), REDACTED (4). — One of this dimension's main actionable groups (66 warning-level).
  2. Resolve the 17 High IaC finding(s) in IaC & Container Security — start with REDACTED (12), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (17 issue-level).
  3. Resolve the 18 Low IaC finding(s) in IaC & Container Security — start with REDACTED (9), REDACTED (8), REDACTED. — One of this dimension's main actionable groups (18 recommendation-level).

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

D34 · Knowledge Freshness2.2 / 10Critical✓ 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 2.2 / 10 · rule-coverage 100% · ceiling Documented

339 of 434 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is ppocr/modeling/heads/rec_unimernet_head.py. Counted over 434 of the 675 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×336REDACTED:1
Most significant orphaned file · ×3ppocr/modeling/heads/rec_unimernet_head.py:1
Concentrated knowledge decay

What to do

  1. Resolve the 336 Orphaned file finding(s) in Knowledge Freshness — start with REDACTED (10), module.py (9), random_crop_data.py (2). — One of this dimension's main actionable groups (336 recommendation-level).
  2. Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with rec_unimernet_head.py, REDACTED, rec_postprocess.py. — One of this dimension's main actionable groups (3 recommendation-level).
  3. Resolve the 1 Concentrated knowledge decay finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

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

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

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

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

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

Strongest change-coupling: REDACTED↔REDACTED 68%; REDACTED↔program.py 68%; REDACTED↔program.py 67%

Change coupling clique: REDACTED, REDACTED, REDACTED, REDACTED, program.pyREDACTED
Change coupling: recovery_to_doc.py ↔ utility.pyppstructure/recovery/recovery_to_doc.py:1

What to do

  1. Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Change coupling finding(s) in Change Coupling — start with recovery_to_doc.py. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 4 platform declaration(s) and 56 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 composition8.9 / 10Strong✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

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

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

What to do

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

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

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

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

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

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

AX6 · Interface segregation10.0 / 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.

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.

C2 · Access Controls0.0 / 10Critical✓ Tool-verified

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

  • This repository serves requests — a request handler (@app.get() (REDACTED:139) — and no route guard, auth-gate middleware, global guard or imperative check that refuses a caller (401/403, an Unauthorized/Forbidden error) was found: its endpoints may be unprotected. — REDACTED:139

What to do

  • Protect endpoints by default-deny: a global authentication guard or middleware with explicit public opt-outs, or a guard on every route, plus named role/permission rules for what an authenticated caller may do.
M1 · Documentation (README)8.7 / 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 12 project(s) that lack one — worth up to 0.7 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 accuracy9.0 / 10Exemplary◐ Sampled · advisory

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.

  • deploy/README.md links to `../doc/doc_en/inference_ppocr_en.md`, but `doc/doc_en/inference_ppocr_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/README.md:24
  • deploy/README.md links to `./cpp_infer/readme.md`, but `deploy/cpp_infer/readme.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/README.md:25
  • deploy/README.md links to `./pdserving/README.md`, but `deploy/pdserving/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/README.md:26
  • deploy/README.md links to `../doc/doc_en/algorithm_overview_en.md`, but `doc/doc_en/algorithm_overview_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/README.md:30
  • docs/FAQ.md documents the environment variable `PADDLE_PDX_LOCAL_FONT_FILE_PATH`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/FAQ.md:885
  • readme/README_ar.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ar.md:259
  • readme/README_ar.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ar.md:280
  • readme/README_cn.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_cn.md:281
  • readme/README_es.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_es.md:257
  • readme/README_es.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_es.md:278
  • readme/README_fr.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_fr.md:257
  • readme/README_fr.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_fr.md:278
  • readme/README_ja.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ja.md:258
  • readme/README_ja.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ja.md:279
  • readme/README_ko.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ko.md:258
  • readme/README_ko.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ko.md:279
  • readme/README_ru.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ru.md:257
  • readme/README_ru.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_ru.md:278
  • readme/README_tcn.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — readme/README_tcn.md:278
  • test_tipc/readme.md names `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt`, but no file or folder `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — test_tipc/readme.md:133
  • api_sdk/go/README_cn.md names `api_sdk/go/v0.1.0`, but no file or folder `api_sdk/go/v0.1.0` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — api_sdk/go/README_cn.md:18
  • benchmark/PaddleOCR_DBNet/README.MD links to `cconfig/icdar2015_resnet18_fpn_DBhead_polyLR.yaml`, but `benchmark/PaddleOCR_DBNet/cconfig/icdar2015_resnet18_fpn_DBhead_polyLR.yaml` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — benchmark/PaddleOCR_DBNet/README.MD:64
  • deploy/hubserving/readme.md links to `../../deploy/pdserving/README_CN.md`, but `deploy/pdserving/README_CN.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/hubserving/readme.md:19
  • deploy/hubserving/readme.md names `./deploy/pdserving`, but no file or folder `deploy/pdserving` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/hubserving/readme.md:19
  • deploy/hubserving/readme_en.md links to `../../deploy/pdserving/README.md`, but `deploy/pdserving/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/hubserving/readme_en.md:18
  • deploy/hubserving/readme_en.md names `./deploy/pdserving`, but no file or folder `deploy/pdserving` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/hubserving/readme_en.md:18
  • deploy/lite/readme.md runs `./lite/tools/build_android.sh --arch=armv8 --with_cv=ON --with_extra=ON`, but `lite/tools/build_android.sh` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme.md:54
  • deploy/lite/readme.md changes into `PaddleOCR/deploy/lite/`, but no such folder exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme.md:187
  • deploy/lite/readme.md changes into `demo/cxx/ocr/`, but no such folder exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme.md:193
  • deploy/lite/readme.md changes into `inference_lite_lib.android.armv8/demo/cxx/ocr/`, but no such folder exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme.md:197
  • deploy/lite/readme_ch.md runs `./lite/tools/build_android.sh --arch=armv8 --with_cv=ON --with_extra=ON`, but `lite/tools/build_android.sh` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme_ch.md:52
  • deploy/lite/readme_ch.md changes into `PaddleOCR/deploy/lite/`, but no such folder exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme_ch.md:187
  • deploy/lite/readme_ch.md changes into `demo/cxx/ocr/`, but no such folder exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/lite/readme_ch.md:193
  • deploy/paddle2onnx/readme.md links to `../../doc/doc_en/models_list_en.md`, but `doc/doc_en/models_list_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/paddle2onnx/readme.md:39
  • deploy/paddle2onnx/readme.md links to `../../doc/doc_en/inference_en.md#1-convert-training-model-to-inference-model`, but `doc/doc_en/inference_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/paddle2onnx/readme.md:40
  • deploy/paddle2onnx/readme_ch.md links to `../../doc/doc_ch/models_list.md`, but `doc/doc_ch/models_list.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/paddle2onnx/readme_ch.md:38
  • deploy/paddle2onnx/readme_ch.md links to `../../doc/doc_ch/inference.md#训练模型转inference模型`, but `doc/doc_ch/inference.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — deploy/paddle2onnx/readme_ch.md:39
  • docs/update/update.en.md documents the environment variable `PADDLE_PDX_MODEL_SOURCE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/update/update.en.md:76
  • docs/update/update.md documents the environment variable `PADDLE_PDX_MODEL_SOURCE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/update/update.md:75
  • ppstructure/kie/README.md links to `../../doc/doc_en/algorithm_overview_en.md`, but `doc/doc_en/algorithm_overview_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — ppstructure/kie/README.md:49

What to do

  • Reconcile the README with reality: deploy/README.md links to `../doc/doc_en/inference_ppocr_en.md`, but `doc/doc_en/inference_ppocr_en.md` does not exist; deploy/README.md links to `./cpp_infer/readme.md`, but `deploy/cpp_infer/readme.md` does not exist; deploy/README.md links to `./pdserving/README.md`, but `deploy/pdserving/README.md` does not exist; deploy/README.md links to `../doc/doc_en/algorithm_overview_en.md`, but `doc/doc_en/algorithm_overview_en.md` does not exist; docs/FAQ.md documents the environment variable `PADDLE_PDX_LOCAL_FONT_FILE_PATH`, but no code, script or configuration file names it.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

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

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

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

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

P2 · Observability6.9 / 10Adequate✓ Tool-verified

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

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

  • Only 5/8 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `deploy/avh`, `deploy/ios_demo`, `mcp_server`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add OpenTelemetry tracing/metrics (opentelemetry-sdk) so requests are traceable across the system, not just health-probable.
P3 · Security & performance tooling3.0 / 10Weak✓ 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.

  • No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 18780 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.

What to do

  • Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
  • Dependabot is configured but does not watch `npm`, `gomod`, `pip`, `gradle` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • 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.

P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

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

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

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

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — ppocr/utils/network.py:70

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
PF2 · Allocation hygiene10.0 / 10Exemplary✓ 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.

PF3 · Async & latency hygiene7.0 / 10Strong✓ 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.

  • `fs.existsSync` in `submitFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — api_sdk/typescript/src/internal/http.ts:90
  • `fs.readFileSync` in `submitFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — api_sdk/typescript/src/internal/http.ts:105

What to do

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

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

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

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication9.1 / 10Exemplary✓ 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.

  • paddleocr-js/packages/core/src/models/det.ts:205 · paddleocr-js/packages/core/src/models/rec.ts:114 — the two spans are one implementation copied and then locally edited — 648 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — paddleocr-js/packages/core/src/models/det.ts:205
  • paddleocr-js/packages/core/src/models/det.ts:119 · paddleocr-js/packages/core/src/models/rec.ts:68 — the two spans are one implementation copied and then locally edited — 153 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — paddleocr-js/packages/core/src/models/det.ts:119
  • api_sdk/typescript/src/client.ts:273 · api_sdk/typescript/src/client.ts:298 — 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. — api_sdk/typescript/src/client.ts:273
  • paddleocr-js/packages/core/src/platform/browser.ts:81 · paddleocr-js/packages/core/src/platform/worker.ts:42 — 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. — paddleocr-js/packages/core/src/platform/browser.ts:81
  • paddleocr-js/packages/core/src/platform/browser.ts:37 · paddleocr-js/packages/core/src/platform/browser.ts:58 — the two spans are one implementation copied and then locally edited — 72 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. — paddleocr-js/packages/core/src/platform/browser.ts:37
  • paddleocr-js/packages/core/src/viz/ocr/draw-boxes.ts:16 · paddleocr-js/packages/core/src/viz/ocr/draw-text.ts:45 — the two spans are one implementation copied and then locally edited — 92 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — paddleocr-js/packages/core/src/viz/ocr/draw-boxes.ts:16
  • api_sdk/typescript/src/client.ts:354 · api_sdk/typescript/src/internal/poller.ts:150 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — api_sdk/typescript/src/client.ts:354
  • api_sdk/typescript/src/internal/http.ts:116 · api_sdk/typescript/src/internal/http.ts:126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — api_sdk/typescript/src/internal/http.ts:116
  • paddleocr-js/packages/core/src/viz/ocr/renderer.ts:47 · paddleocr-js/packages/core/src/viz/ocr/renderer.ts:57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — paddleocr-js/packages/core/src/viz/ocr/renderer.ts:47
  • paddleocr-js/packages/core/src/models/common.ts:159 · paddleocr-js/packages/core/src/models/common.ts: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. — paddleocr-js/packages/core/src/models/common.ts:159
  • api_sdk/typescript/src/client.ts:79 · api_sdk/typescript/src/client.ts:85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — api_sdk/typescript/src/client.ts:79

What to do

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

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

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

  • predict has cyclomatic complexity 25 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — paddleocr-js/packages/core/src/pipelines/ocr/core.ts:197
  • normalizeOcrPipelineConfig has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — paddleocr-js/packages/core/src/pipelines/ocr/config.ts:133
  • fetch has cyclomatic complexity 21 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — api_sdk/typescript/src/internal/http.ts:178
  • decodeDetOutput has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — paddleocr-js/packages/core/src/models/det.ts:468
  • readExplicitPipelineRuntimeDefaults has cyclomatic complexity 15 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:210
  • drawTextPanel has cyclomatic complexity 12 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — paddleocr-js/packages/core/src/viz/ocr/draw-text.ts:74
  • similar has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — test_tipc/web/index.test.js:50
  • parseDetModelConfigText 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. — paddleocr-js/packages/core/src/models/det.ts:119

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files8.3 / 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.

  • paddleocr-js/packages/core/src/pipelines/ocr/shared.ts has 579 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:1
  • paddleocr-js/packages/core/src/models/det.ts has 507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — paddleocr-js/packages/core/src/models/det.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 Coverage10.0 / 10Exemplary✓ Tool-verified

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

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

R5 · Dependency Freshness8.7 / 10Strong✓ 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.

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

  • 3 file(s) (~207 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.
  • 2 file(s) (~60 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. — paddleocr-js
  • Unreachable from the 4 application, 8 tooling and 39 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (4 application, 8 tooling, 39 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 — paddleocr-js/packages/core/src/types/index.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 Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

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 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

Other · Security — Only what this repository's own non-C# files could be read for was assessed — markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.

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://giscus.app/client.js` 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. — overrides/partials/comments.html:5

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

Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context or an AbortSignal (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.

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 `NullPointerException` (Java, Kotlin, Scala), `ArgumentError.notNull` (Dart) or `ArgumentNullException` (F#'s `nullArg`) 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 unescaped7.2 / 10Strong✓ Tool-verified

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.

  • `name` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `name` at this site, or validate it against the shape the position accepts before interpolating it. — paddleocr/_doc2md/converters/docx.py:1120

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
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 `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen. Whether a `for (x in c)` or `c.forEach { … }` leaves the collection it is walking alone — a `mutableListOf`/`ArrayList`, `mutableMapOf`/`HashMap` or `mutableSetOf`/`HashSet` is a `java.util` collection on the JVM and is walked by its own fail-fast iterator, so a body that adds to or removes from the very collection the loop is walking makes the next step throw `ConcurrentModificationException` and the remaining elements are never seen.

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

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

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

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

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

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

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

X3 · Exception handling5.1 / 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.

  • `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — api_sdk/go/resource.go:256
  • `if err := validateResultResourceFilename(" " + ext); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — api_sdk/go/resource.go:263
  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — api_sdk/typescript/src/client.ts:201
  • 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. (×20) — api_sdk/typescript/src/internal/http.ts:233, paddleocr-js/packages/core/src/pipelines/ocr/worker-backed.ts:132, paddleocr/_doc2md/converters/xlsx.py:210, …
  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×16) — REDACTED:153, mcp_server/paddleocr_mcp/tasks/mcp_image.py:59, paddleocr/_doc2md/converters/pptx.py:303, …
  • `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — deploy/slim/auto_compression/ppocrv4_det_server_dataset_process.py:32

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.

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

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

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

  • `error` at line 204 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — paddleocr/_cli.py:204
  • `info` at line 209 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — paddleocr/_cli.py:209
  • `info` at line 213 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — paddleocr/_cli.py:213
  • `info` at line 215 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — paddleocr/_cli.py:215
  • `debug` at line 73 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — tools/infer/predict_system.py:73
  • `debug` at line 140 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — tools/infer/predict_system.py:140

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types9.9 / 10Exemplary✓ Tool-verified

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

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

  • ~0.2 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 5777 source line(s) of the 47 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: api_sdk/typescript/src/client.ts (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

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

Reference — by lens

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

LensScoreRatingImpact
Code Health71%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture95%ExemplaryStrongest area.
Maturity73%Adequate — gated by D34Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness57%Adequate — gated by P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security33%Weak — gated by D29, D30, D31, D36, C2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance83%StrongSolid.
Unscored — 2 check(s) recorded observations but carry no score

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

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

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

  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 47 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 — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC2 Forms & labels — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC3 Page structure — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC4 Keyboard semantics — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC5 ARIA correctness — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC6 Visual & motion safety — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC7 A11y enforcement — Frontend below the scale floor (9 DOM element(s) < 25) — too little surface to assess accessibility.
  • AX1 Captive dependencies — Not applicable: this repository's Go imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Java imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Kotlin imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No Go request handler (a net/http, Gin, Echo, Fiber or fasthttp handler, or a gRPC service method) is declared as a method or function, and no handler function literal writes a value captured from outside it, so no state is shared between request goroutines. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No class in this Kotlin code is a Spring, JSR-330 or CDI singleton bean. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the Android app did not build — `./gradlew :app:assembleDebug` exited 1: ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation.; runtime evidence skipped (launch chosen because deploy/ppocr-android/app/build.gradle.kts applies the Android application plugin and deploy/ppocr-android/gradlew builds it) This is a statement about this run, not a statement about your application: nothing here says the app is inaccessible, only that it was never run.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — LLM evaluation failed
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • 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 (.py), 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) — 3 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 2 needed — the count is met but a required primary signal is absent): 1 aggregate root(s) (entities that raise its domain events); 37 value object(s); 1 domain event(s); no aggregate is declared and no domain structure surrounds the state-guarding types: not claimed as DDD
  • 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
  • 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
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage data present for 36 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a pytest-benchmark or pytest-codspeed dependency with tests taking the `benchmark` fixture, an asv.conf.json with its `time_`/`mem_`/`peakmem_` benchmarks, or a pyperf Runner, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 431 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
  • + 268 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
  • + 33 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
  • + 1 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · High CVE · ×18
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×17
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×1
  • REDACTED
Serious — 1016 finding(s)
D31 · IaC & Container Security · Medium IaC · ×66
  • 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
  • + 41 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×27
  • TodoComment paddleocr/_cli.py:127 — # TODO: Register the subparser whether the plugin is installed or not — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment paddleocr/_pipelines/pp_chatocrv4_doc.py:589 — # TODO: Support dict and list types — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment paddleocr/_pipelines/ocr.py:15 — # TODO: Should we use a third-party CLI library to auto-generate command-line — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/data/collate_fn.py:27 — # todo:support batch operators — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/data/collate_fn.py:47 — # todo:support batch operators — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:511 — # todo: change to 0 and modified image shape — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:661 — # todo: change to 0 and modified image shape — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:1157 — # TODO: use tok.all_special_ids to remove — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/data/imaug/abinet_aug.py:253 — # TODO: more robust way to crop image — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:97 — # TODO: n,h,w,c format is not supported yet — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/modeling/heads/rec_unimernet_head.py:1757 — # TODO: add counting context weight to hidden_states — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/modeling/heads/rec_latexocr_head.py:760 — # TODO: think of a cleaner solution — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/modeling/heads/rec_abinet_head.py:158 — # TODO q=f(q,k) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppocr/modeling/heads/rec_abinet_head.py:249 — # TODO:move to language model — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppstructure/recovery/table_process.py:120 — # TODO need some way to get rid of extra spaces in e.g. text <span> </span> text — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment ppstructure/recovery/table_process.py:171 — # TODO add this option back in? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:848 — # TODO: — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_table_recognition_v2.py:80 — # TODO: Test constructor and other methods — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_pp_structurev3.py:88 — # TODO: Test constructor and other methods — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_pp_doctranslation.py:96 — # TODO: Test constructor and other methods — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_pp_chatocrv4_doc.py:96 — # TODO: Test constructor and other methods — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_ocr.py:33 — # TODO: Should we separate unit tests and integration tests? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_formula_recognition.py:32 — # TODO: Should we separate unit tests and integration tests? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_ocr.py:59 — # TODO: Also check passing `None` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/pipelines/test_formula_recognition.py:57 — # TODO: Also check passing `None` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×27
  • Duplicated block (8 lines × 2) ppocr/data/collate_fn.py:51 — ppocr/data/collate_fn.py:51-58 | tools/infer_kie_token_ser.py:49-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) ppocr/data/imaug/abinet_aug.py:400 — ppocr/data/imaug/abinet_aug.py:400-407 | ppocr/data/imaug/abinet_aug.py:436-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/data/imaug/abinet_aug.py:409` calls `shuffle`, `Compose` and `ppocr/data/imaug/abinet_aug.py:444` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) REDACTED:130 — REDACTED:130-137 | ppocr/postprocess/rec_postprocess.py:36-43 — 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) REDACTED:87 — REDACTED:87-94 | REDACTED:81-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) ppocr/data/imaug/pg_process.py:979 — ppocr/data/imaug/pg_process.py:979-986 | ppocr/data/imaug/sast_process.py:712-719 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) REDACTED:512 — REDACTED:512-519 | tools/infer/predict_cls.py:69-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 (8 lines × 2) ppocr/data/imaug/unimernet_aug.py:172 — ppocr/data/imaug/unimernet_aug.py:172-179 | ppocr/data/imaug/unimernet_aug.py:275-283 — both copies are in the same file, so extract the 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 `ppocr/data/imaug/unimernet_aug.py:275` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) ppocr/data/pubtab_dataset.py:73 — ppocr/data/pubtab_dataset.py:73-80 | ppocr/data/pubtab_dataset.py:98-105 — both copies are in the same file, so extract the block into 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) ppocr/modeling/backbones/rec_donut_swin.py:725 — ppocr/modeling/backbones/rec_donut_swin.py:725-732 | ppocr/modeling/backbones/rec_donut_swin.py:757-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/modeling/backbones/rec_donut_swin.py:723` calls `to_tensor`, `cast` and `ppocr/modeling/backbones/rec_donut_swin.py:755` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) ppocr/modeling/backbones/rec_hgnet.py:271 — ppocr/modeling/backbones/rec_hgnet.py:271-278 | REDACTED:1393-1400 — 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) REDACTED:29 — REDACTED:29-36 | REDACTED:39-46 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:34` calls `to_2tuple`, `tuple` and `REDACTED:25` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) ppocr/modeling/transforms/tbsrn.py:242 — ppocr/modeling/transforms/tbsrn.py:242-249 | ppocr/modeling/transforms/tsrn.py:117-125 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/transforms/tbsrn.py:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) ppocr/postprocess/sast_postprocess.py:56 — ppocr/postprocess/sast_postprocess.py:56-64 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:317-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.
  • Duplicated block (8 lines × 2) ppocr/utils/utility.py:27 — ppocr/utils/utility.py:27-34 | REDACTED:25-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) ppocr/utils/visual.py:33 — ppocr/utils/visual.py:33-40 | ppocr/utils/visual.py:90-97 — both copies are in the same file, so extract the block into 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) test_tipc/supplementary/config.py:17 — test_tipc/supplementary/config.py:17-24 | tools/program.py:46-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `test_tipc/supplementary/config.py:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 2) tools/infer/predict_cls.py:91 — tools/infer/predict_cls.py:91-99 | tools/infer/predict_rec.py:584-591 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/infer/predict_cls.py:90` calls `deepcopy` and `tools/infer/predict_rec.py:583` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) tools/infer/predict_det.py:77 — tools/infer/predict_det.py:77-84 | tools/infer/predict_det.py: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.
  • Duplicated block (8 lines × 2) tools/infer/predict_rec.py:254 — tools/infer/predict_rec.py:254-261 | tools/infer/predict_rec.py:421-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) REDACTED:69 — REDACTED:69-76 | REDACTED:9-16 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) ppocr/modeling/backbones/det_mobilenet_v3.py:251 — ppocr/modeling/backbones/det_mobilenet_v3.py:251-258 | test_tipc/supplementary/mv3.py:303-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:838 — ppocr/modeling/heads/rec_ppformulanet_head.py:838-845 | ppocr/modeling/heads/rec_unimernet_head.py:2300-2308 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) ppocr/data/imaug/ct_process.py:231 — ppocr/data/imaug/ct_process.py:231-238 | ppocr/data/imaug/random_crop_data.py:549-556 — 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) api_sdk/go/ocr.go:176 — api_sdk/go/ocr.go:176-183 | api_sdk/go/ocr.go:213-220 — both copies are in the same file, so extract the block into 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:458 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:458-465 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:521-528 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 · FileTooLong · ×26
  • FileTooLong: heads/rec_unimernet_head.py ppocr/modeling/heads/rec_unimernet_head.py — FileTooLong — 1974 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1474 over it, 3.95× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1758 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1258 over it, 3.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: converters/docx.py paddleocr/_doc2md/converters/docx.py — FileTooLong — 1225 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 725 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: postprocess/rec_postprocess.py ppocr/postprocess/rec_postprocess.py — FileTooLong — 1212 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 712 over it, 2.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1115 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 615 over it, 2.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: heads/rec_ppformulanet_head.py ppocr/modeling/heads/rec_ppformulanet_head.py — FileTooLong — 987 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 487 over it, 1.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: losses/distillation_loss.py ppocr/losses/distillation_loss.py — FileTooLong — 984 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 484 over it, 1.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backbones/rec_resnetv2.py ppocr/modeling/backbones/rec_resnetv2.py — FileTooLong — 959 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 459 over it, 1.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: backbones/rec_donut_swin.py ppocr/modeling/backbones/rec_donut_swin.py — FileTooLong — 898 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 398 over it, 1.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _pipelines/pp_structurev3.py paddleocr/_pipelines/pp_structurev3.py — FileTooLong — 834 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 334 over it, 1.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: imaug/pg_process.py ppocr/data/imaug/pg_process.py — FileTooLong — 822 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 322 over it, 1.64× 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: infer/predict_rec.py tools/infer/predict_rec.py — FileTooLong — 784 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 284 over it, 1.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/program.py tools/program.py — FileTooLong — 784 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 284 over it, 1.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: infer/utility.py tools/infer/utility.py — FileTooLong — 771 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 271 over it, 1.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: heads/rec_latexocr_head.py ppocr/modeling/heads/rec_latexocr_head.py — FileTooLong — 767 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 267 over it, 1.53× 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: _pipelines/pp_doctranslation.py paddleocr/_pipelines/pp_doctranslation.py — FileTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 244 over it, 1.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: necks/db_fpn.py ppocr/modeling/necks/db_fpn.py — FileTooLong — 721 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 221 over it, 1.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 720 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 220 over it, 1.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: imaug/unimernet_aug.py ppocr/data/imaug/unimernet_aug.py — FileTooLong — 649 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 149 over it, 1.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: _pipelines/pp_chatocrv4_doc.py paddleocr/_pipelines/pp_chatocrv4_doc.py — FileTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 90 over it, 1.18× 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: REDACTED REDACTED — FileTooLong — 576 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 76 over it, 1.15× 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: imaug/sast_process.py ppocr/data/imaug/sast_process.py — FileTooLong — 546 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 46 over it, 1.09× 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: imaug/drrg_targets.py ppocr/data/imaug/drrg_targets.py — FileTooLong — 540 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 40 over it, 1.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: REDACTED REDACTED — FileTooLong — 537 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 37 over it, 1.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: backbones/rec_lcnetv4.py ppocr/modeling/backbones/rec_lcnetv4.py — FileTooLong — 523 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 23 over it, 1.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×22
  • Duplicated block (5 lines × 2) ppocr/data/imaug/latex_ocr_aug.py:104 — ppocr/data/imaug/latex_ocr_aug.py:104-108 | tools/infer/predict_rec.py:500-504 — 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) ppocr/data/imaug/pg_process.py:823 — ppocr/data/imaug/pg_process.py:823-827 | ppocr/data/imaug/sast_process.py:601-605 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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) REDACTED:36 — REDACTED:36-40 | REDACTED:36-40 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 48 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) ppocr/modeling/heads/proposal_local_graph.py:41 — ppocr/modeling/heads/proposal_local_graph.py:41-45 | ppocr/postprocess/fce_postprocess.py:29-33 — 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) ppocr/modeling/heads/rec_satrn_head.py:139 — ppocr/modeling/heads/rec_satrn_head.py:139-143 | ppocr/modeling/heads/rec_satrn_head.py:339-343 — both copies are in the same file, so extract the 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 `ppocr/modeling/heads/rec_satrn_head.py:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) ppocr/modeling/necks/rf_adaptor.py:57 — ppocr/modeling/necks/rf_adaptor.py:57-61 | ppocr/modeling/necks/rf_adaptor.py:90-94 — both copies are in the same file, so extract the block into 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) ppocr/modeling/necks/rnn.py:229 — ppocr/modeling/necks/rnn.py:229-233 | ppocr/modeling/necks/rnn.py:338-342 — both copies are in the same file, so extract the block into 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) mcp_server/paddleocr_mcp/inference/ocr/local.py:60 — mcp_server/paddleocr_mcp/inference/ocr/local.py:60-64 | mcp_server/paddleocr_mcp/inference/paddleocr_vl/local.py:45-49 — 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) ppocr/data/imaug/pg_process.py:774 — ppocr/data/imaug/pg_process.py:774-778 | ppocr/data/imaug/sast_process.py:550-554 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) ppocr/modeling/backbones/det_pp_lcnet.py:124 — ppocr/modeling/backbones/det_pp_lcnet.py:124-128 | ppocr/modeling/backbones/rec_lcnetv3.py:396-400 — before extracting anything, compare `ppocr/modeling/backbones/det_pp_lcnet.py` and `ppocr/modeling/backbones/rec_lcnetv3.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) ppocr/modeling/backbones/det_pp_lcnet_v2.py:79 — ppocr/modeling/backbones/det_pp_lcnet_v2.py:79-83 | ppocr/modeling/backbones/rec_hgnet.py:66-70 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) REDACTED:568 — REDACTED:568-572 | ppocr/postprocess/rec_postprocess.py:444-448 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) ppocr/losses/rec_sar_loss.py:11 — ppocr/losses/rec_sar_loss.py:11-15 | ppocr/losses/rec_satrn_loss.py:28-32 — before extracting anything, compare `ppocr/losses/rec_sar_loss.py` and `ppocr/losses/rec_satrn_loss.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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) ppocr/data/imaug/fce_aug.py:244 — ppocr/data/imaug/fce_aug.py:244-248 | ppocr/data/imaug/fce_aug.py:254-258 — both copies are in the same file, so extract the block into 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) ppocr/data/imaug/fce_aug.py:432 — ppocr/data/imaug/fce_aug.py:432-436 | ppocr/data/imaug/fce_aug.py:530-534 — both copies are in the same file, so extract the 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 `ppocr/data/imaug/fce_aug.py:432` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) ppocr/modeling/backbones/rec_lcnetv4.py:207 — ppocr/modeling/backbones/rec_lcnetv4.py:207-211 | ppocr/modeling/backbones/rec_lcnetv4.py:269-273 — both copies are in the same file, so extract the 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 `ppocr/modeling/backbones/rec_lcnetv4.py:207` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) ppocr/modeling/necks/pren_fpn.py:95 — ppocr/modeling/necks/pren_fpn.py:95-99 | ppocr/modeling/necks/pren_fpn.py:103-107 — both copies are in the same file, so extract the block into 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) ppocr/utils/visual.py:81 — ppocr/utils/visual.py:81-85 | ppstructure/kie/tools/trans_funsd_label.py:24-28 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 2) tools/infer/utility.py:704 — tools/infer/utility.py:704-708 | tools/infer/utility.py:711-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.
  • Duplicated block (5 lines × 2) ppocr/utils/e2e_metric/Deteval.py:71 — ppocr/utils/e2e_metric/Deteval.py:71-75 | ppocr/utils/e2e_metric/Deteval.py:202-206 — both copies are in the same file, so extract the block into 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:393 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:393-397 | ppocr/utils/e2e_utils/pgnet_pp_utils.py:153-157 — 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) deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java:186 — deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java:186-190 | deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/SettingsActivity.java:121-125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java:186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×20
  • Duplicated block (6 lines × 2) ppocr/data/imaug/fce_targets.py:612 — ppocr/data/imaug/fce_targets.py:612-617 | ppocr/data/imaug/fce_targets.py:621-626 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) ppocr/data/imaug/pg_process.py:1091 — ppocr/data/imaug/pg_process.py:1091-1096 | ppocr/data/imaug/sast_process.py:796-801 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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) REDACTED:718 — REDACTED:718-723 | tools/infer/predict_rec.py:463-468 — 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) ppocr/data/imaug/unimernet_aug.py:171 — ppocr/data/imaug/unimernet_aug.py:171-176 | ppocr/data/imaug/unimernet_aug.py:209-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.
  • Duplicated block (6 lines × 2) ppocr/modeling/heads/det_ct_head.py:49 — ppocr/modeling/heads/det_ct_head.py:49-54 | ppocr/modeling/necks/ct_fpn.py:53-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) ppocr/modeling/heads/table_att_head.py:102 — ppocr/modeling/heads/table_att_head.py:102-107 | ppocr/modeling/heads/table_att_head.py:129-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/modeling/heads/table_att_head.py:125` calls `argmax`, `structure_generator`, `softmax` and `ppocr/modeling/heads/table_att_head.py:101` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) ppocr/modeling/transforms/tbsrn.py:172 — ppocr/modeling/transforms/tbsrn.py:172-177 | ppocr/modeling/transforms/tsrn.py:75-80 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/transforms/tbsrn.py:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) ppocr/postprocess/db_postprocess.py:97 — ppocr/postprocess/db_postprocess.py:97-102 | ppocr/postprocess/db_postprocess.py:148-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/postprocess/db_postprocess.py:97` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) ppocr/utils/utility.py:35 — ppocr/utils/utility.py:35-40 | REDACTED:33-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/utils/utility.py:35` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) ppstructure/utility.py:34 — ppstructure/utility.py:34-39 | tools/infer/utility.py:95-100 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `ppstructure/utility.py:34` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) test_tipc/supplementary/config.py:120 — test_tipc/supplementary/config.py:120-125 | tools/program.py:884-889 — 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) tools/infer/utility.py:66 — tools/infer/utility.py:66-71 | tools/infer/utility.py:74-79 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/infer/utility.py:74` calls `add_argument` and `tools/infer/utility.py:86` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py:53 — mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py:53-58 | mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py:53-58 — `mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py` and `mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py` 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 27 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) REDACTED:2062 — REDACTED:2062-2067 | ppocr/postprocess/rec_postprocess.py:1417-1422 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) ppocr/data/imaug/latex_ocr_aug.py:72 — ppocr/data/imaug/latex_ocr_aug.py:72-77 | ppocr/data/imaug/unimernet_aug.py:459-464 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (6 lines × 2) ppocr/modeling/backbones/rec_hybridvit.py:55 — ppocr/modeling/backbones/rec_hybridvit.py:55-60 | ppocr/modeling/backbones/rec_resnetv2.py:45-50 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/modeling/backbones/rec_hybridvit.py:50` calls `TruncatedNormal`, `XavierUniform` and `ppocr/modeling/backbones/rec_resnetv2.py:41` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) ppocr/data/collate_fn.py:96 — ppocr/data/collate_fn.py:96-101 | ppocr/data/collate_fn.py:153-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 (6 lines × 2) ppocr/modeling/necks/db_fpn.py:416 — ppocr/modeling/necks/db_fpn.py:416-421 | ppocr/modeling/necks/db_fpn.py:937-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) api_sdk/go/ocr.go:185 — api_sdk/go/ocr.go:185-190 | api_sdk/go/ocr.go:222-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. Read the line range as the matched WINDOW rather than a finished unit: at `api_sdk/go/ocr.go:185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) api_sdk/go/ocr.go:49 — api_sdk/go/ocr.go:49-54 | api_sdk/go/ocr.go:68-73 — both copies are in the same file, so extract the 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 `api_sdk/go/ocr.go:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×20
  • Swallowed exception (caught, then discarded) api_sdk/go/resource.go:256 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) api_sdk/go/resource.go:263 — `if err := validateResultResourceFilename(" " + ext); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) api_sdk/typescript/src/client.ts:201 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:153 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) deploy/slim/auto_compression/ppocrv4_det_server_dataset_process.py:32 — `except` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) mcp_server/paddleocr_mcp/tasks/mcp_image.py:59 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:303 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:349 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:412 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:419 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:455 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/pptx.py:527 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:120 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:128 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:558 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:994 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:1135 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:1169 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:1218 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) paddleocr/_doc2md/converters/docx.py:1234 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
X3 · Exception handling · Swallowed exception (empty catch) · ×20
  • Swallowed exception (empty catch) api_sdk/typescript/src/internal/http.ts:233 — 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) paddleocr-js/packages/core/src/pipelines/ocr/worker-backed.ts:132 — 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) paddleocr/_doc2md/converters/xlsx.py:210 — 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) paddleocr/_doc2md/converters/xlsx.py:273 — 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) paddleocr/_doc2md/converters/xlsx.py:281 — 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) paddleocr/_doc2md/converters/xlsx.py:309 — 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) paddleocr/_doc2md/converters/pptx.py:66 — 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) paddleocr/_doc2md/converters/pptx.py:87 — 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) paddleocr/_doc2md/converters/pptx.py:356 — 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) paddleocr/_doc2md/converters/docx.py:70 — 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) paddleocr/_doc2md/converters/docx.py:75 — 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) paddleocr/_doc2md/converters/docx.py:88 — 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) paddleocr/_doc2md/converters/docx.py:93 — 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) paddleocr/_doc2md/converters/docx.py:106 — 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) paddleocr/_doc2md/converters/docx.py:111 — 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) paddleocr/_doc2md/converters/docx.py:187 — 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) paddleocr/_doc2md/converters/docx.py:210 — 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) paddleocr/_doc2md/converters/docx.py:896 — 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) paddleocr/_doc2md/converters/docx.py:1526 — 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) paddleocr/_doc2md/converters/docx.py:1539 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×19
  • Duplicated block (7 lines × 2) paddleocr/_doc2md/converters/docx.py:1015 — paddleocr/_doc2md/converters/docx.py:1015-1021 | paddleocr/_doc2md/converters/pptx.py:374-380 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `paddleocr/_doc2md/converters/pptx.py:372` calls `find` and `paddleocr/_doc2md/converters/docx.py:1013` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) ppocr/data/imaug/ct_process.py:34 — ppocr/data/imaug/ct_process.py:34-40 | ppocr/data/imaug/ct_process.py:362-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) REDACTED:666 — REDACTED:666-672 | tools/infer/predict_rec.py:416-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 (7 lines × 2) ppocr/losses/det_ct_loss.py:104 — ppocr/losses/det_ct_loss.py:104-110 | ppocr/utils/iou.py:48-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/losses/distillation_loss.py:830 — ppocr/losses/distillation_loss.py:830-836 | ppocr/losses/distillation_loss.py:977-983 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) REDACTED:101 — REDACTED:101-107 | REDACTED:110-116 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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) ppocr/utils/export_model.py:438 — ppocr/utils/export_model.py:438-444 | ppocr/utils/export_model.py:457-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) ppocr/data/imaug/pg_process.py:781 — ppocr/data/imaug/pg_process.py:781-787 | ppocr/data/imaug/sast_process.py:557-563 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/data/imaug/pg_process.py:797 — ppocr/data/imaug/pg_process.py:797-803 | ppocr/data/imaug/sast_process.py:573-579 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:67 — ppocr/modeling/heads/rec_ppformulanet_head.py:67-73 | ppocr/modeling/heads/rec_unimernet_head.py:285-291 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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) ppocr/modeling/heads/rec_ppformulanet_head.py:245 — ppocr/modeling/heads/rec_ppformulanet_head.py:245-252 | ppocr/modeling/heads/rec_unimernet_head.py:324-330 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/data/imaug/drrg_targets.py:594 — ppocr/data/imaug/drrg_targets.py:594-600 | ppocr/modeling/heads/proposal_local_graph.py:149-155 — 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) REDACTED:272 — REDACTED:272-278 | REDACTED:171-177 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 48 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/modeling/backbones/rec_svtrv2.py:146 — ppocr/modeling/backbones/rec_svtrv2.py:146-152 | REDACTED:124-130 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/rec_svtrv2.py:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) ppocr/modeling/transforms/gaspin_transformer.py:237 — ppocr/modeling/transforms/gaspin_transformer.py:237-243 | ppocr/modeling/transforms/tps.py:156-162 — 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) deploy/ios_demo/scripts/build_onnx_calib_npy.py:194 — deploy/ios_demo/scripts/build_onnx_calib_npy.py:194-200 | deploy/ios_demo/scripts/build_onnx_calib_npy.py:211-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) ppocr/losses/e2e_pg_loss.py:46 — ppocr/losses/e2e_pg_loss.py:46-52 | ppocr/losses/e2e_pg_loss.py:73-79 — both copies are in the same file, so extract the block into 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:384 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:384-390 | ppocr/utils/e2e_utils/pgnet_pp_utils.py:139-145 — 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:200 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:200-206 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:227-233 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×17
  • Duplicated block (10 lines × 2) mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:120 — mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:120-129 | mcp_server/paddleocr_mcp/inference/shared/http_result_parsers.py:34-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) paddleocr/_doc2md/converters/docx.py:866 — paddleocr/_doc2md/converters/docx.py:866-875 | paddleocr/_doc2md/converters/docx.py:1193-1202 — both copies are in the same file, so extract the block into 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) REDACTED:2049 — REDACTED:2049-2058 | ppocr/postprocess/rec_postprocess.py:1404-1413 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) ppocr/data/imaug/pg_process.py:110 — ppocr/data/imaug/pg_process.py:110-119 | ppocr/data/imaug/sast_process.py:89-98 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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.
  • Duplicated block (10 lines × 2) ppocr/data/imaug/pg_process.py:1005 — ppocr/data/imaug/pg_process.py:1005-1014 | ppocr/data/imaug/sast_process.py:738-747 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:1005` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) ppocr/data/imaug/pg_process.py:1017 — ppocr/data/imaug/pg_process.py:1017-1026 | ppocr/data/imaug/sast_process.py:750-759 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 lines × 2) ppocr/data/imaug/pg_process.py:1037 — ppocr/data/imaug/pg_process.py:1037-1046 | ppocr/data/imaug/sast_process.py:771-780 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 lines × 2) ppocr/modeling/backbones/rec_donut_swin.py:706 — ppocr/modeling/backbones/rec_donut_swin.py:706-715 | ppocr/modeling/backbones/rec_donut_swin.py:740-749 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/backbones/rec_donut_swin.py:716` calls `zeros` and `ppocr/modeling/backbones/rec_donut_swin.py:751` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) ppocr/modeling/backbones/rec_resnetv2.py:469 — ppocr/modeling/backbones/rec_resnetv2.py:469-478 | ppocr/modeling/backbones/rec_resnetv2.py:517-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/backbones/rec_resnetv2.py:479` calls `register_buffer`, `ones` and `ppocr/modeling/backbones/rec_resnetv2.py:527` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) ppocr/modeling/heads/rec_unimernet_head.py:1375 — ppocr/modeling/heads/rec_unimernet_head.py:1375-1384 | ppocr/modeling/heads/rec_unimernet_head.py:1385-1394 — both copies are in the same file, so extract the block into 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) ppocr/postprocess/drrg_postprocess.py:328 — ppocr/postprocess/drrg_postprocess.py:328-337 | ppocr/postprocess/fce_postprocess.py:118-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/postprocess/fce_postprocess.py:117` calls `valid_boundary` and `ppocr/postprocess/drrg_postprocess.py:327` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) REDACTED:978 — REDACTED:978-987 | ppocr/postprocess/rec_postprocess.py:878-887 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) ppocr/modeling/backbones/rec_donut_swin.py:302 — ppocr/modeling/backbones/rec_donut_swin.py:302-311 | ppocr/modeling/backbones/rec_hybridvit.py:104-113 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) REDACTED:105 — REDACTED:105-114 | REDACTED:225-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:80 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:80-89 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:145-154 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) deploy/ios_demo/PaddleOCRDemo/Engine/ModelConfig.swift:74 — deploy/ios_demo/PaddleOCRDemo/Engine/ModelConfig.swift:74-83 | deploy/ios_demo/PaddleOCRDemo/Engine/ModelConfig.swift:86-95 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:25 — deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:25-34 | deploy/ios_demo/PaddleOCRDemo/Engine/RecPreprocessor.swift:25-34 — 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 (9 lines × 2) · ×17
  • Duplicated block (9 lines × 2) paddleocr/_doc2md/converters/docx.py:1005 — paddleocr/_doc2md/converters/docx.py:1005-1013 | paddleocr/_doc2md/converters/pptx.py:362-370 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `paddleocr/_doc2md/converters/pptx.py:372` calls `find` and `paddleocr/_doc2md/converters/docx.py:1015` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) ppocr/data/imaug/drrg_targets.py:189 — ppocr/data/imaug/drrg_targets.py:189-197 | ppocr/data/imaug/fce_targets.py:160-168 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) ppocr/data/imaug/pg_process.py:440 — ppocr/data/imaug/pg_process.py:440-448 | ppocr/data/imaug/sast_process.py:246-254 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) ppocr/data/imaug/text_image_aug/augment.py:27 — ppocr/data/imaug/text_image_aug/augment.py:27-35 | ppocr/data/imaug/text_image_aug/augment.py:105-113 — both copies are in the same file, so extract the block into 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) ppocr/data/imaug/unimernet_aug.py:541 — ppocr/data/imaug/unimernet_aug.py:541-549 | ppocr/data/imaug/unimernet_aug.py:648-656 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) REDACTED:164 — REDACTED:164-172 | ppocr/modeling/backbones/rec_svtrv2.py:131-139 — before extracting anything, compare `REDACTED` and `ppocr/modeling/backbones/rec_svtrv2.py` as WHOLE FILES: this scan already matched 5 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 (9 lines × 2) ppocr/modeling/heads/det_ct_head.py:37 — ppocr/modeling/heads/det_ct_head.py:37-45 | ppocr/modeling/heads/det_pse_head.py:25-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) ppocr/modeling/heads/rec_latexocr_head.py:919 — ppocr/modeling/heads/rec_latexocr_head.py:919-927 | ppocr/modeling/heads/rec_latexocr_head.py:977-985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) ppocr/modeling/necks/sast_fpn.py:112 — ppocr/modeling/necks/sast_fpn.py:112-120 | ppocr/modeling/necks/sast_fpn.py:199-207 — both copies are in the same file, so extract the block into 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) ppocr/postprocess/rec_postprocess.py:164 — ppocr/postprocess/rec_postprocess.py:164-172 | ppocr/postprocess/rec_postprocess.py:1077-1086 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/postprocess/rec_postprocess.py:164` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) ppocr/postprocess/rec_postprocess.py:261 — ppocr/postprocess/rec_postprocess.py:261-269 | ppocr/postprocess/rec_postprocess.py:860-868 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) tools/eval.py:73 — tools/eval.py:73-81 | tools/infer_rec.py:84-92 — before extracting anything, compare `tools/eval.py` and `tools/infer_rec.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/infer_rec.py:82` calls `getattr` and `tools/eval.py:71` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) REDACTED:83 — REDACTED:83-91 | tools/infer/predict_det.py:186-194 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) REDACTED:76 — REDACTED:76-84 | REDACTED:70-78 — 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:160 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:160-168 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:187-195 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:486 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:486-494 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:549-557 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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) deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:155 — deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:155-163 | deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:190-198 — both copies are in the same file, so extract the 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 `deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:155` 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 (11 lines × 2) · ×14
  • Duplicated block (11 lines × 2) deploy/slim/quantization/quant.py:105 — deploy/slim/quantization/quant.py:105-115 | tools/train.py:76-86 — before extracting anything, compare `deploy/slim/quantization/quant.py` and `tools/train.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/slim/quantization/quant.py:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) mcp_server/paddleocr_mcp/inference/ocr/local.py:110 — mcp_server/paddleocr_mcp/inference/ocr/local.py:110-120 | mcp_server/paddleocr_mcp/inference/shared/http_result_parsers.py:27-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `mcp_server/paddleocr_mcp/inference/ocr/local.py:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) paddleocr/_api_client/_http.py:160 — paddleocr/_api_client/_http.py:160-170 | paddleocr/_api_client/_http.py:173-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) paddleocr/_doc2md/converters/pptx.py:287 — paddleocr/_doc2md/converters/pptx.py:287-298 | paddleocr/_doc2md/converters/pptx.py:511-521 — both copies are in the same file, so extract the 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) ppocr/data/imaug/drrg_targets.py:178 — ppocr/data/imaug/drrg_targets.py:178-188 | ppocr/data/imaug/fce_targets.py:149-159 — 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) ppocr/data/imaug/latex_ocr_aug.py:173 — ppocr/data/imaug/latex_ocr_aug.py:173-183 | ppocr/data/imaug/unimernet_aug.py:824-834 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) ppocr/data/imaug/make_border_map.py:167 — ppocr/data/imaug/make_border_map.py:167-177 | ppocr/data/imaug/make_border_map.py:180-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/make_border_map.py:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) ppocr/data/imaug/pg_process.py:540 — ppocr/data/imaug/pg_process.py:540-550 | ppocr/data/imaug/sast_process.py:312-322 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/data/imaug/pg_process.py:551` calls `fillPoly`, `round`, `astype` and `ppocr/data/imaug/sast_process.py:325` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) ppocr/losses/rec_att_loss.py:31 — ppocr/losses/rec_att_loss.py:31-41 | ppocr/losses/rec_spin_att_loss.py:40-50 — 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) ppocr/modeling/heads/rec_ppformulanet_head.py:1085 — ppocr/modeling/heads/rec_ppformulanet_head.py:1085-1095 | ppocr/modeling/heads/rec_ppformulanet_head.py:1224-1234 — both copies are in the same file, so extract the 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 `ppocr/modeling/heads/rec_ppformulanet_head.py:1085` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) tools/infer/utility.py:587 — tools/infer/utility.py:587-597 | tools/infer_e2e.py:81-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 (11 lines × 2) ppocr/data/imaug/pg_process.py:293 — ppocr/data/imaug/pg_process.py:293-303 | ppocr/data/imaug/pg_process.py:393-403 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) deploy/ios_demo/PaddleOCRDemo/App/ContentView.swift:310 — deploy/ios_demo/PaddleOCRDemo/App/ContentView.swift:310-320 | deploy/ios_demo/PaddleOCRDemo/App/DemoSectionChrome.swift:51-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/ios_demo/PaddleOCRDemo/App/ContentView.swift:310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:143 — deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:143-153 | deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:178-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. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/ios_demo/PaddleOCRDemo/Views/OCRParametersPanel.swift:143` 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 (17 lines × 2) · ×13
  • Duplicated block (17 lines × 2) ppocr/data/imaug/latex_ocr_aug.py:110 — ppocr/data/imaug/latex_ocr_aug.py:110-126 | tools/infer/predict_rec.py:506-522 — 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) ppocr/data/imaug/pg_process.py:137 — ppocr/data/imaug/pg_process.py:137-153 | ppocr/data/imaug/sast_process.py:116-132 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (17 lines × 2) REDACTED:403 — REDACTED:403-419 | REDACTED:512-528 — both copies are in the same file, so extract the block into 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) ppocr/modeling/backbones/det_pp_lcnet.py:133 — ppocr/modeling/backbones/det_pp_lcnet.py:133-149 | ppocr/modeling/backbones/det_pp_lcnet_v2.py:88-104 — 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 (17 lines × 2) ppocr/modeling/backbones/rec_lcnetv3.py:92 — ppocr/modeling/backbones/rec_lcnetv3.py:92-108 | REDACTED: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.
  • Duplicated block (17 lines × 2) ppocr/modeling/backbones/rec_lcnetv4.py:239 — ppocr/modeling/backbones/rec_lcnetv4.py:239-255 | REDACTED:975-991 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:993` calls `LearnableAffineBlock` and `ppocr/modeling/backbones/rec_lcnetv4.py:257` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) REDACTED:367 — REDACTED:367-383 | REDACTED:433-449 — both copies are in the same file, so extract the 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 `REDACTED:367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) ppocr/modeling/backbones/rec_resnet_rfl.py:188 — ppocr/modeling/backbones/rec_resnet_rfl.py:188-204 | ppocr/modeling/backbones/rec_resnet_rfl.py:307-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 (17 lines × 2) REDACTED:304 — REDACTED:304-320 | REDACTED:334-350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:304` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) ppocr/modeling/heads/rec_robustscanner_head.py:451 — ppocr/modeling/heads/rec_robustscanner_head.py:451-467 | ppocr/modeling/heads/rec_robustscanner_head.py:489-505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) ppocr/postprocess/db_postprocess.py:170 — ppocr/postprocess/db_postprocess.py:170-186 | tools/infer/utility.py:914-930 — 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) REDACTED:88 — REDACTED:88-105 | REDACTED:317-333 — both copies are in the same file, so extract the 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 `REDACTED:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:217 — deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:217-233 | deploy/ios_demo/PaddleOCRDemo/Engine/RecPreprocessor.swift:276-292 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:217` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D29 · Static Analysis (SAST) · REDACTED · ×12
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×12
  • Duplicated block (14 lines × 2) mcp_server/paddleocr_mcp/inference/shared/paddleocr_api_sdk.py:77 — mcp_server/paddleocr_mcp/inference/shared/paddleocr_api_sdk.py:77-90 | mcp_server/paddleocr_mcp/inference/shared/paddleocr_api_sdk.py:97-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) paddleocr/_pipelines/pp_chatocrv4_doc.py:131 — paddleocr/_pipelines/pp_chatocrv4_doc.py:131-144 | paddleocr/_pipelines/pp_doctranslation.py:140-153 — before extracting anything, compare `paddleocr/_pipelines/pp_chatocrv4_doc.py` and `paddleocr/_pipelines/pp_doctranslation.py` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 372 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/pp_chatocrv4_doc.py:131` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) ppocr/data/imaug/latex_ocr_aug.py:133 — ppocr/data/imaug/latex_ocr_aug.py:133-146 | tools/infer/predict_rec.py:534-547 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) ppocr/data/imaug/pg_process.py:832 — ppocr/data/imaug/pg_process.py:832-845 | ppocr/data/imaug/sast_process.py:610-623 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:832` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:732 — REDACTED:732-745 | tools/infer/predict_rec.py:298-311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:732` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) ppocr/modeling/heads/det_drrg_head.py:58 — ppocr/modeling/heads/det_drrg_head.py:58-71 | ppocr/modeling/heads/proposal_local_graph.py:70-83 — 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) ppocr/modeling/heads/rec_att_head.py:187 — ppocr/modeling/heads/rec_att_head.py:187-200 | ppocr/modeling/heads/rec_spin_att_head.py:96-109 — before extracting anything, compare `ppocr/modeling/heads/rec_att_head.py` and `ppocr/modeling/heads/rec_spin_att_head.py` 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. 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) ppocr/modeling/heads/rec_latexocr_head.py:891 — ppocr/modeling/heads/rec_latexocr_head.py:891-904 | ppocr/modeling/heads/rec_latexocr_head.py:945-958 — both copies are in the same file, so extract the block into 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) ppocr/modeling/heads/rec_ppformulanet_head.py:385 — ppocr/modeling/heads/rec_ppformulanet_head.py:385-398 | ppocr/modeling/heads/rec_unimernet_head.py:405-418 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:385` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) ppstructure/kie/tools/eval_with_label_end2end.py:187 — ppstructure/kie/tools/eval_with_label_end2end.py:187-200 | tools/end2end/eval_end2end.py:167-180 — before extracting anything, compare `ppstructure/kie/tools/eval_with_label_end2end.py` and `tools/end2end/eval_end2end.py` as WHOLE FILES: this scan already matched 3 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. 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 (14 lines × 2) REDACTED:289 — REDACTED:289-302 | REDACTED:423-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:289` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:336 — deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:336-349 | deploy/ios_demo/PaddleOCRDemo/Engine/RecPreprocessor.swift:297-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:336` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D30 · Dependency Vulnerabilities · Medium CVE · ×11
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×11
  • Members sharing a duplicated core (4 members, 50+ identical tokens) ppocr/data/imaug/east_process.py:292 — ppocr/data/imaug/east_process.py:292-364 | ppocr/data/imaug/fce_aug.py:87-185 | ppocr/data/imaug/pg_process.py:158-236 | ppocr/data/imaug/sast_process.py:135-207 — 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) REDACTED:878 — REDACTED:878-889 | REDACTED:927-938 | ppocr/postprocess/rec_postprocess.py:693-703 | ppocr/postprocess/rec_postprocess.py:768-778 — 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) ppocr/modeling/backbones/det_resnet_vd_sast.py:39 — ppocr/modeling/backbones/det_resnet_vd_sast.py:39-66 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:39-66 | ppocr/modeling/backbones/rec_resnet_vd.py:39-66 | ppocr/modeling/necks/pg_fpn.py:37-65 — 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) ppocr/modeling/backbones/det_resnet_vd_sast.py:86 — ppocr/modeling/backbones/det_resnet_vd_sast.py:86-121 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:84-119 | ppocr/modeling/backbones/rec_resnet_fpn.py:243-275 | ppocr/modeling/backbones/rec_resnet_vd.py:86-121 — 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) ppocr/modeling/backbones/rec_resnet_32.py:109 — ppocr/modeling/backbones/rec_resnet_32.py:109-123 | ppocr/modeling/backbones/rec_resnet_45.py:71-85 | ppocr/modeling/backbones/rec_resnet_aster.py:65-76 | ppocr/modeling/backbones/rec_resnet_rfl.py:70-84 — 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) ppocr/modeling/heads/rec_ppformulanet_head.py:1062 — ppocr/modeling/heads/rec_ppformulanet_head.py:1062-1180 | ppocr/modeling/heads/rec_ppformulanet_head.py:1188-1292 | ppocr/modeling/heads/rec_unimernet_head.py:2416-2489 | ppocr/modeling/heads/rec_unimernet_head.py:2497-2574 — 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) ppocr/modeling/necks/db_fpn.py:248 — ppocr/modeling/necks/db_fpn.py:248-268 | ppocr/modeling/necks/db_fpn.py:334-374 | ppocr/modeling/necks/db_fpn.py:434-506 | ppocr/modeling/necks/db_fpn.py:839-895 — 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) ppocr/postprocess/sast_postprocess.py:56 — ppocr/postprocess/sast_postprocess.py:56-65 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:317-325 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:39-58 | ppocr/utils/e2e_utils/visual.py:96-115 — 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/infer_cls.py:41 — tools/infer_cls.py:41-79 | tools/infer_det.py:58-138 | tools/infer_e2e.py:103-165 | tools/infer_table.py:47-115 — 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:160 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:160-196 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:486-523 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:187-223 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:549-586 — 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) ppocr/utils/e2e_utils/extract_textpoint_fast.py:210 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:210-254 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:258-313 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:237-282 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:286-342 — 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) · ×11
  • Duplicated block (16 lines × 2) paddleocr/_doc2md/converters/docx.py:422 — paddleocr/_doc2md/converters/docx.py:422-437 | paddleocr/_doc2md/converters/docx.py:443-458 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) paddleocr/_pipelines/pp_chatocrv4_doc.py:184 — paddleocr/_pipelines/pp_chatocrv4_doc.py:184-199 | paddleocr/_pipelines/pp_doctranslation.py:211-226 — before extracting anything, compare `paddleocr/_pipelines/pp_chatocrv4_doc.py` and `paddleocr/_pipelines/pp_doctranslation.py` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 372 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/pp_chatocrv4_doc.py:184` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) ppocr/modeling/heads/det_sast_head.py:38 — ppocr/modeling/heads/det_sast_head.py:38-53 | ppocr/modeling/necks/sast_fpn.py:37-52 — before extracting anything, compare `ppocr/modeling/heads/det_sast_head.py` and `ppocr/modeling/necks/sast_fpn.py` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_sast_head.py:38` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1132 — ppocr/modeling/heads/rec_ppformulanet_head.py:1132-1147 | ppocr/modeling/heads/rec_ppformulanet_head.py:1250-1265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:1132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1159 — ppocr/modeling/heads/rec_ppformulanet_head.py:1159-1174 | ppocr/modeling/heads/rec_ppformulanet_head.py:1274-1289 — both copies are in the same file, so extract the 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 `ppocr/modeling/heads/rec_ppformulanet_head.py:1159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) ppocr/modeling/necks/db_fpn.py:474 — ppocr/modeling/necks/db_fpn.py:474-489 | ppocr/modeling/necks/db_fpn.py:866-881 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:474` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) ppstructure/kie/tools/eval_with_label_end2end.py:71 — ppstructure/kie/tools/eval_with_label_end2end.py:71-86 | tools/end2end/eval_end2end.py:48-63 — before extracting anything, compare `ppstructure/kie/tools/eval_with_label_end2end.py` and `tools/end2end/eval_end2end.py` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) tools/infer_det.py:68 — tools/infer_det.py:68-83 | tools/infer_e2e.py:114-129 — before extracting anything, compare `tools/infer_det.py` and `tools/infer_e2e.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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.
  • Duplicated block (16 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:818 — ppocr/modeling/heads/rec_ppformulanet_head.py:818-833 | ppocr/modeling/heads/rec_unimernet_head.py:2264-2280 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16 lines × 2) REDACTED:237 — REDACTED:237-252 | REDACTED:357-372 — both copies are in the same file, so extract the block into 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) deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:370 — deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:370-385 | deploy/ios_demo/PaddleOCRDemo/Engine/RecPreprocessor.swift:328-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 (12 lines × 2) · ×11
  • Duplicated block (12 lines × 2) REDACTED:57 — REDACTED:57-68 | REDACTED:50-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) ppocr/data/imaug/table_ops.py:37 — ppocr/data/imaug/table_ops.py:37-48 | ppocr/data/imaug/table_ops.py:87-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) ppocr/modeling/backbones/e2e_resnet_vd_pg.py:190 — ppocr/modeling/backbones/e2e_resnet_vd_pg.py:190-201 | ppocr/modeling/backbones/rec_resnet_vd.py:193-204 — before extracting anything, compare `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` and `ppocr/modeling/backbones/rec_resnet_vd.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 123 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) ppocr/modeling/heads/rec_ppformulanet_head.py:1117 — ppocr/modeling/heads/rec_ppformulanet_head.py:1117-1128 | ppocr/modeling/heads/rec_unimernet_head.py:2535-2546 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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) ppocr/modeling/necks/db_fpn.py:453 — ppocr/modeling/necks/db_fpn.py:453-466 | ppocr/modeling/necks/db_fpn.py:850-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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:453` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) ppocr/postprocess/picodet_postprocess.py:52 — ppocr/postprocess/picodet_postprocess.py:52-63 | ppocr/postprocess/picodet_postprocess.py:82-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.
  • Duplicated block (12 lines × 2) ppocr/postprocess/rec_postprocess.py:151 — ppocr/postprocess/rec_postprocess.py:151-162 | ppocr/postprocess/rec_postprocess.py:1064-1075 — both copies are in the same file, so extract the 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 `ppocr/postprocess/rec_postprocess.py:151` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) ppstructure/kie/tools/eval_with_label_end2end.py:143 — ppstructure/kie/tools/eval_with_label_end2end.py:143-154 | tools/end2end/eval_end2end.py:123-134 — before extracting anything, compare `ppstructure/kie/tools/eval_with_label_end2end.py` and `tools/end2end/eval_end2end.py` as WHOLE FILES: this scan already matched 3 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. 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 × 2) REDACTED:815 — REDACTED:815-826 | ppocr/postprocess/table_postprocess.py:160-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:471 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:471-482 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:534-545 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_slow.py:386 — ppocr/utils/e2e_utils/extract_textpoint_slow.py:386-397 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:464-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×10
  • Duplicated block (13 lines × 2) deploy/slim/quantization/export_model.py:69 — deploy/slim/quantization/export_model.py:69-81 | ppocr/utils/export_model.py:422-434 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/slim/quantization/export_model.py:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) ppocr/modeling/backbones/rec_resnet_32.py:292 — ppocr/modeling/backbones/rec_resnet_32.py:292-304 | ppocr/modeling/backbones/rec_resnet_rfl.py:229-241 — before extracting anything, compare `ppocr/modeling/backbones/rec_resnet_32.py` and `ppocr/modeling/backbones/rec_resnet_rfl.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) REDACTED:55 — REDACTED:55-67 | ppocr/modeling/backbones/rec_svtrv2.py:100-112 — before extracting anything, compare `REDACTED` and `ppocr/modeling/backbones/rec_svtrv2.py` as WHOLE FILES: this scan already matched 5 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 (13 lines × 2) REDACTED:300 — REDACTED:300-312 | REDACTED:321-333 — both copies are in the same file, so extract the 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 `REDACTED:300` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1062 — ppocr/modeling/heads/rec_ppformulanet_head.py:1062-1074 | ppocr/modeling/heads/rec_ppformulanet_head.py:1202-1215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/heads/rec_ppformulanet_head.py:1076` calls `reshape` and `ppocr/modeling/heads/rec_ppformulanet_head.py:1217` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1166 — ppocr/modeling/heads/rec_ppformulanet_head.py:1166-1180 | ppocr/modeling/heads/rec_unimernet_head.py:2562-2574 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:1166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) ppocr/modeling/transforms/tbsrn.py:226 — ppocr/modeling/transforms/tbsrn.py:226-238 | ppocr/modeling/transforms/tsrn.py:101-113 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) REDACTED:51 — REDACTED:51-63 | REDACTED:25-37 — 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) ppstructure/pdf2word/pdf2word.py:392 — ppstructure/pdf2word/pdf2word.py:392-404 | ppstructure/pdf2word/pdf2word.py:407-419 — both copies are in the same file, so extract the block into 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) ppocr/utils/e2e_metric/Deteval.py:564 — ppocr/utils/e2e_metric/Deteval.py:564-576 | ppocr/utils/e2e_metric/Deteval.py:579-591 — both copies are in the same file, so extract the 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 × 2) · ×9
  • Duplicated block (20 lines × 2) deploy/slim/prune/sensitivity_anal.py:58 — deploy/slim/prune/sensitivity_anal.py:58-77 | deploy/slim/quantization/quant.py:91-110 — 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 (20 lines × 2) paddleocr/_doc2md/converters/docx.py:330 — paddleocr/_doc2md/converters/docx.py:330-349 | paddleocr/_doc2md/converters/docx.py:491-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) ppocr/data/imaug/drrg_targets.py:667 — ppocr/data/imaug/drrg_targets.py:667-686 | ppocr/data/imaug/fce_targets.py:552-571 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (20 lines × 2) ppocr/data/imaug/pg_process.py:882 — ppocr/data/imaug/pg_process.py:882-901 | ppocr/data/imaug/sast_process.py:660-679 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:882` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) ppocr/modeling/backbones/rec_mv1_enhance.py:256 — ppocr/modeling/backbones/rec_mv1_enhance.py:256-275 | test_tipc/supplementary/mv3.py:315-334 — 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 (20 lines × 2) ppocr/modeling/backbones/vqa_layoutlm.py:127 — ppocr/modeling/backbones/vqa_layoutlm.py:127-146 | ppocr/modeling/backbones/vqa_layoutlm.py:169-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) ppocr/modeling/necks/rnn.py:169 — ppocr/modeling/necks/rnn.py:169-188 | ppocr/modeling/necks/rnn.py:287-306 — both copies are in the same file, so extract the 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 `ppocr/modeling/necks/rnn.py:169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) ppocr/postprocess/rec_postprocess.py:286 — ppocr/postprocess/rec_postprocess.py:286-305 | ppocr/postprocess/rec_postprocess.py:364-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_slow.py:39 — ppocr/utils/e2e_utils/extract_textpoint_slow.py:39-58 | ppocr/utils/e2e_utils/visual.py:96-115 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_slow.py` and `ppocr/utils/e2e_utils/visual.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×7
  • Duplicated block (18 lines × 2) ppocr/data/imaug/pg_process.py:482 — ppocr/data/imaug/pg_process.py:482-499 | ppocr/data/imaug/sast_process.py:266-283 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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) ppocr/losses/rec_sar_loss.py:18 — ppocr/losses/rec_sar_loss.py:18-35 | ppocr/losses/rec_satrn_loss.py:35-52 — before extracting anything, compare `ppocr/losses/rec_sar_loss.py` and `ppocr/losses/rec_satrn_loss.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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) ppocr/modeling/backbones/rec_resnet_32.py:273 — ppocr/modeling/backbones/rec_resnet_32.py:273-290 | ppocr/modeling/backbones/rec_resnet_rfl.py:329-346 — before extracting anything, compare `ppocr/modeling/backbones/rec_resnet_32.py` and `ppocr/modeling/backbones/rec_resnet_rfl.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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) REDACTED:259 — REDACTED:259-276 | REDACTED:76-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:259` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) REDACTED:110 — REDACTED:110-127 | REDACTED:94-111 — before extracting anything, compare `REDACTED` and `REDACTED` 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) ppstructure/table/matcher.py:119 — ppstructure/table/matcher.py:119-136 | ppstructure/table/matcher.py:164-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppstructure/table/matcher.py:118` calls `extend` and `ppstructure/table/matcher.py:163` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) ppocr/utils/e2e_metric/Deteval.py:658 — ppocr/utils/e2e_metric/Deteval.py:658-675 | ppocr/utils/e2e_metric/Deteval.py:678-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. 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 (9 lines × 3) · ×7
  • Duplicated block (9 lines × 3) deploy/slim/quantization/quant.py:48 — deploy/slim/quantization/quant.py:48-56 | deploy/slim/quantization/quant_kl.py:50-58 | test_tipc/supplementary/slim/slim_quant.py:10-18 — before extracting anything, compare `deploy/slim/quantization/quant.py` and `test_tipc/supplementary/slim/slim_quant.py` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 × 3) ppocr/losses/rec_att_loss.py:30 — ppocr/losses/rec_att_loss.py:30-38 | ppocr/losses/rec_rfl_loss.py:50-58 | ppocr/losses/rec_spin_att_loss.py:39-47 — 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 (9 lines × 3) ppocr/modeling/backbones/rec_resnet_32.py:262 — ppocr/modeling/backbones/rec_resnet_32.py:262-270 | ppocr/modeling/backbones/rec_resnet_rfl.py:199-207 | ppocr/modeling/backbones/rec_resnet_rfl.py:318-326 — before extracting anything, compare `ppocr/modeling/backbones/rec_resnet_32.py` and `ppocr/modeling/backbones/rec_resnet_rfl.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/rec_resnet_32.py:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 3) ppocr/postprocess/rec_postprocess.py:1241 — ppocr/postprocess/rec_postprocess.py:1241-1249 | ppocr/postprocess/rec_postprocess.py:1500-1508 | ppocr/postprocess/rec_postprocess.py:1525-1533 — 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) mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:64 — mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:64-72 | mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py:65-73 | mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py:65-73 — `mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py` and `mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py` 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 27 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 3) ppocr/modeling/heads/rec_att_head.py:27 — ppocr/modeling/heads/rec_att_head.py:27-35 | ppocr/modeling/heads/rec_att_head.py:120-128 | ppocr/modeling/heads/rec_spin_att_head.py:31-39 — before extracting anything, compare `ppocr/modeling/heads/rec_att_head.py` and `ppocr/modeling/heads/rec_spin_att_head.py` 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. 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 × 3) REDACTED:107 — REDACTED:107-115 | REDACTED:227-235 | REDACTED:338-346 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×6
  • Duplicated block (15 lines × 2) paddleocr/_pipelines/ocr.py:113 — paddleocr/_pipelines/ocr.py:113-127 | paddleocr/_pipelines/pp_structurev3.py:120-134 — before extracting anything, compare `paddleocr/_pipelines/ocr.py` and `paddleocr/_pipelines/pp_structurev3.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 233 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 (15 lines × 2) ppocr/data/imaug/pg_process.py:649 — ppocr/data/imaug/pg_process.py:649-663 | ppocr/data/imaug/sast_process.py:434-448 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 (15 lines × 2) REDACTED:1641 — REDACTED:1641-1655 | REDACTED:1699-1713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:106 — ppocr/modeling/heads/rec_ppformulanet_head.py:106-120 | ppocr/modeling/heads/rec_ppformulanet_head.py:151-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) tools/infer_rec.py:97 — tools/infer_rec.py:97-111 | tools/infer_sr.py:50-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:50 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:50-64 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:115-129 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/utils/e2e_utils/extract_textpoint_fast.py:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (5 members, 50+ identical tokens) ppocr/data/imaug/east_process.py:292 — ppocr/data/imaug/east_process.py:292-364 | ppocr/data/imaug/fce_aug.py:188-224 | ppocr/data/imaug/pg_process.py:158-236 | ppocr/data/imaug/random_crop_data.py:417-463 | ppocr/data/imaug/sast_process.py:135-207 — 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) ppocr/losses/distillation_loss.py:89 — ppocr/losses/distillation_loss.py:89-99 | ppocr/losses/distillation_loss.py:185-195 | ppocr/losses/distillation_loss.py:293-303 | ppocr/losses/distillation_loss.py:439-449 | ppocr/losses/distillation_loss.py:547-557 — 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) ppocr/losses/rec_att_loss.py:29 — ppocr/losses/rec_att_loss.py:29-43 | ppocr/losses/rec_rfl_loss.py:36-70 | ppocr/losses/rec_sar_loss.py:18-36 | ppocr/losses/rec_satrn_loss.py:35-53 | ppocr/losses/rec_spin_att_loss.py:36-52 — 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) ppocr/modeling/backbones/det_resnet.py:75 — ppocr/modeling/backbones/det_resnet.py:75-86 | ppocr/modeling/backbones/det_resnet_vd.py:202-212 | ppocr/modeling/backbones/det_resnet_vd_sast.py:124-134 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:122-132 | ppocr/modeling/backbones/rec_resnet_vd.py:124-135 — 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) ppocr/postprocess/rec_postprocess.py:316 — ppocr/postprocess/rec_postprocess.py:316-333 | ppocr/postprocess/rec_postprocess.py:395-420 | ppocr/postprocess/rec_postprocess.py:743-753 | ppocr/postprocess/rec_postprocess.py:818-828 | ppocr/postprocess/rec_postprocess.py:935-960 — 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 (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) deploy/slim/prune/export_prune_model.py:45 — deploy/slim/prune/export_prune_model.py:45-65 | deploy/slim/prune/sensitivity_anal.py:72-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (21 lines × 2) ppocr/data/imaug/table_ops.py:49 — ppocr/data/imaug/table_ops.py:49-69 | ppocr/data/imaug/table_ops.py:100-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (21 lines × 2) ppocr/metrics/det_metric.py:31 — ppocr/metrics/det_metric.py:31-51 | ppocr/metrics/det_metric.py:81-102 — both copies are in the same file, so extract the 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 `ppocr/metrics/det_metric.py:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) ppocr/modeling/necks/fpn.py:39 — ppocr/modeling/necks/fpn.py:39-59 | ppocr/modeling/necks/fpn.py:100-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.
  • Duplicated block (21 lines × 2) tools/infer/predict_rec.py:782 — tools/infer/predict_rec.py:782-802 | tools/infer/predict_rec.py:805-825 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×5
  • Duplicated block (16–17 lines × 2) REDACTED:80 — REDACTED:80-96 | REDACTED:20-35 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (16–17 lines × 2) ppocr/modeling/necks/east_fpn.py:80 — ppocr/modeling/necks/east_fpn.py:80-95 | ppocr/modeling/necks/pg_fpn.py:86-102 — before extracting anything, compare `ppocr/modeling/necks/east_fpn.py` and `ppocr/modeling/necks/pg_fpn.py` as WHOLE FILES: this scan already matched 3 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/east_fpn.py:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) ppocr/modeling/transforms/tbsrn.py:155 — ppocr/modeling/transforms/tbsrn.py:155-171 | ppocr/modeling/transforms/tsrn.py:59-74 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/transforms/tbsrn.py:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16–17 lines × 2) api_sdk/go/transport.go:181 — api_sdk/go/transport.go:181-197 | api_sdk/go/transport.go:213-228 — both copies are in the same file, so extract the 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (16–17 lines × 2) REDACTED:181 — REDACTED:181-196 | REDACTED:297-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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×5
  • Duplicated block (12 lines × 3) mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:89 — mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:89-100 | mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py:91-102 | mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py:92-103 — `mcp_server/paddleocr_mcp/inference/paddleocr_vl/aistudio.py` and `mcp_server/paddleocr_mcp/inference/pp_structurev3/aistudio.py` 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 27 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) REDACTED:369 — REDACTED:369-380 | REDACTED:405-416 | REDACTED:514-525 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:367` calls `randint`, `__len__` and `REDACTED:404` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) ppocr/modeling/backbones/det_resnet_vd.py:316 — ppocr/modeling/backbones/det_resnet_vd.py:316-327 | ppocr/modeling/backbones/det_resnet_vd_sast.py:261-272 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:241-252 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 8 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet_vd.py:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) ppocr/modeling/heads/rec_srn_head.py:57 — ppocr/modeling/heads/rec_srn_head.py:57-68 | ppocr/modeling/heads/rec_srn_head.py:141-152 | ppocr/modeling/heads/rec_srn_head.py:158-169 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_srn_head.py:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) tools/infer/predict_rec.py:718 — tools/infer/predict_rec.py:718-729 | tools/infer/predict_rec.py:742-753 | tools/infer/predict_rec.py:765-776 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/infer/predict_rec.py:718` 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 (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) ppocr/data/imaug/unimernet_aug.py:556 — ppocr/data/imaug/unimernet_aug.py:556-563 | ppocr/data/imaug/unimernet_aug.py:696-703 | ppocr/data/imaug/unimernet_aug.py:795-802 — 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.
  • Duplicated block (8 lines × 3) configs/rec/multi_language/generate_multi_language_configs.py:177 — configs/rec/multi_language/generate_multi_language_configs.py:177-184 | test_tipc/supplementary/config.py:35-42 | tools/program.py:65-72 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) ppocr/data/imaug/pg_process.py:58 — ppocr/data/imaug/pg_process.py:58-65 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:28-35 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:28-35 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) ppocr/modeling/backbones/det_pp_lcnet.py:153 — ppocr/modeling/backbones/det_pp_lcnet.py:153-160 | ppocr/modeling/backbones/det_pp_lcnet_v2.py:108-115 | ppocr/modeling/backbones/rec_lcnetv3.py:349-356 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 3) REDACTED:171 — REDACTED:171-178 | REDACTED:287-294 | REDACTED:421-428 — 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 (27 lines × 2) · ×4
  • Duplicated block (27 lines × 2) ppocr/data/imaug/drrg_targets.py:83 — ppocr/data/imaug/drrg_targets.py:83-109 | ppocr/data/imaug/fce_targets.py:184-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 (27 lines × 2) ppocr/data/imaug/drrg_targets.py:149 — ppocr/data/imaug/drrg_targets.py:149-175 | ppocr/data/imaug/fce_targets.py:250-276 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/drrg_targets.py:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (27 lines × 2) ppocr/utils/e2e_metric/Deteval.py:512 — ppocr/utils/e2e_metric/Deteval.py:512-538 | ppocr/utils/e2e_metric/Deteval.py:606-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 (27 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:228 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:228-254 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:256-282 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×4
  • Duplicated block (25 lines × 2) configs/rec/multi_language/generate_multi_language_configs.py:222 — configs/rec/multi_language/generate_multi_language_configs.py:222-246 | test_tipc/supplementary/config.py:82-106 — 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) ppocr/data/imaug/east_process.py:75 — ppocr/data/imaug/east_process.py:75-99 | ppocr/data/imaug/pg_process.py:913-937 — 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 (25 lines × 2) REDACTED:78 — REDACTED:78-124 | REDACTED:38-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (25 lines × 2) api_sdk/go/transport.go:78 — api_sdk/go/transport.go:78-102 | api_sdk/go/transport.go:150-174 — both copies are in the same file, so extract the 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 `api_sdk/go/transport.go:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×4
  • Duplicated block (11–12 lines × 3) deploy/slim/quantization/export_model.py:96 — deploy/slim/quantization/export_model.py:96-106 | deploy/slim/quantization/quant.py:130-140 | tools/train.py:108-119 — before extracting anything, compare `deploy/slim/quantization/export_model.py` and `deploy/slim/quantization/quant.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 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–12 lines × 3) REDACTED:147 — REDACTED:147-157 | REDACTED:161-171 | REDACTED:178-189 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Callable` names `collections` in one and `collections.abc` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11–12 lines × 3) ppocr/modeling/heads/rec_att_head.py:104 — ppocr/modeling/heads/rec_att_head.py:104-115 | ppocr/modeling/heads/rec_att_head.py:205-215 | ppocr/modeling/heads/rec_spin_att_head.py:114-124 — before extracting anything, compare `ppocr/modeling/heads/rec_att_head.py` and `ppocr/modeling/heads/rec_spin_att_head.py` 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. 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11–12 lines × 3) REDACTED:180 — REDACTED:180-190 | REDACTED:296-307 | REDACTED:430-440 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:180` 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 (11 lines × 3) · ×4
  • Duplicated block (11 lines × 3) ppocr/data/imaug/pg_process.py:677 — ppocr/data/imaug/pg_process.py:677-687 | ppocr/data/imaug/sast_process.py:65-75 | ppocr/data/imaug/sast_process.py:462-472 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:677` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) ppocr/data/pgnet_dataset.py:61 — ppocr/data/pgnet_dataset.py:61-71 | ppocr/data/pubtab_dataset.py:58-68 | REDACTED:291-301 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 3) ppocr/postprocess/rec_postprocess.py:545 — ppocr/postprocess/rec_postprocess.py:545-555 | ppocr/postprocess/rec_postprocess.py:706-716 | ppocr/postprocess/rec_postprocess.py:781-791 — 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.
  • Duplicated block (11 lines × 3) mcp_server/paddleocr_mcp/inference/ocr/local.py:88 — mcp_server/paddleocr_mcp/inference/ocr/local.py:88-98 | mcp_server/paddleocr_mcp/inference/paddleocr_vl/local.py:77-87 | mcp_server/paddleocr_mcp/inference/pp_structurev3/local.py:62-72 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×4
  • Duplicated block (7 lines × 4) ppocr/data/imaug/pg_process.py:90 — ppocr/data/imaug/pg_process.py:90-96 | ppocr/data/imaug/pg_process.py:681-687 | ppocr/data/imaug/sast_process.py:69-75 | ppocr/data/imaug/sast_process.py:466-472 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) ppocr/postprocess/rec_postprocess.py:290 — ppocr/postprocess/rec_postprocess.py:290-296 | ppocr/postprocess/rec_postprocess.py:368-374 | ppocr/postprocess/rec_postprocess.py:710-716 | ppocr/postprocess/rec_postprocess.py:785-791 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/postprocess/rec_postprocess.py:289` calls `get_ignored_tokens` and `ppocr/postprocess/rec_postprocess.py:708` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) tools/eval.py:56 — tools/eval.py:56-62 | tools/eval.py:72-78 | tools/infer_rec.py:66-72 | tools/infer_rec.py:83-89 — before extracting anything, compare `tools/eval.py` and `tools/infer_rec.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/infer_rec.py:82` calls `getattr` and `tools/eval.py:71` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) REDACTED:104 — REDACTED:104-110 | ppocr/modeling/backbones/rec_svtrv2.py:71-77 | REDACTED:71-77 | REDACTED:81-87 — before extracting anything, compare `REDACTED` and `ppocr/modeling/backbones/rec_svtrv2.py` as WHOLE FILES: this scan already matched 5 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 · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (9 members, 50+ identical tokens) deploy/hubserving/kie_ser/module.py:50 — deploy/hubserving/kie_ser/module.py:50-70 | deploy/hubserving/kie_ser_re/module.py:50-70 | deploy/hubserving/ocr_cls/module.py:46-66 | deploy/hubserving/ocr_det/module.py:48-68 | deploy/hubserving/ocr_rec/module.py:46-66 | deploy/hubserving/ocr_system/module.py:49-69 | deploy/hubserving/structure_layout/module.py:48-67 | deploy/hubserving/structure_system/module.py:50-70 | deploy/hubserving/structure_table/module.py:50-69 — These 9 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 9 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 9 times.
  • Members sharing a duplicated core (9 members, 50+ identical tokens) deploy/hubserving/kie_ser/module.py:76 — deploy/hubserving/kie_ser/module.py:76-86 | deploy/hubserving/kie_ser_re/module.py:76-86 | deploy/hubserving/ocr_cls/module.py:72-82 | deploy/hubserving/ocr_det/module.py:74-84 | deploy/hubserving/ocr_rec/module.py:72-82 | deploy/hubserving/ocr_system/module.py:75-85 | deploy/hubserving/structure_layout/module.py:71-81 | deploy/hubserving/structure_system/module.py:74-84 | deploy/hubserving/structure_table/module.py:73-83 — These 9 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 9 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 9 times.
  • Members sharing a duplicated core (9 members, 50+ identical tokens) deploy/hubserving/kie_ser/module.py:102 — deploy/hubserving/kie_ser/module.py:102-132 | deploy/hubserving/kie_ser_re/module.py:102-134 | deploy/hubserving/ocr_cls/module.py:98-139 | deploy/hubserving/ocr_det/module.py:100-135 | deploy/hubserving/ocr_rec/module.py:98-139 | deploy/hubserving/ocr_system/module.py:101-145 | deploy/hubserving/structure_layout/module.py:97-131 | deploy/hubserving/structure_system/module.py:100-137 | deploy/hubserving/structure_table/module.py:99-131 — These 9 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 9 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 9 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:327 — REDACTED:327-347 | REDACTED:372-387 | REDACTED:390-417 | ppocr/utils/e2e_utils/visual.py:20-46 | ppocr/utils/e2e_utils/visual.py:50-70 | ppocr/utils/e2e_utils/visual.py:74-92 — 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) ppocr/data/imaug/pg_process.py:702 — ppocr/data/imaug/pg_process.py:702-710 | ppocr/data/imaug/sast_process.py:487-495 | ppocr/postprocess/sast_postprocess.py:68-76 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:329-332 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:62-68 | ppocr/utils/e2e_utils/visual.py:119-125 — 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.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) ppocr/postprocess/rec_postprocess.py:286 — ppocr/postprocess/rec_postprocess.py:286-313 | ppocr/postprocess/rec_postprocess.py:364-391 | ppocr/postprocess/rec_postprocess.py:464-488 | ppocr/postprocess/rec_postprocess.py:545-571 | ppocr/postprocess/rec_postprocess.py:706-740 | ppocr/postprocess/rec_postprocess.py:781-815 — 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 (22–23 lines × 2) · ×3
  • Duplicated block (22–23 lines × 2) paddleocr/_pipelines/paddleocr_vl.py:428 — paddleocr/_pipelines/paddleocr_vl.py:428-449 | paddleocr/_pipelines/pp_structurev3.py:1003-1025 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_structurev3.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 354 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22–23 lines × 2) ppocr/data/imaug/drrg_targets.py:709 — ppocr/data/imaug/drrg_targets.py:709-731 | ppocr/data/imaug/fce_targets.py:658-679 — 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 (22–23 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:978 — ppocr/modeling/heads/rec_ppformulanet_head.py:978-1000 | ppocr/modeling/heads/rec_unimernet_head.py:2165-2186 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 lines × 2) · ×3
  • Duplicated block (22 lines × 2) ppocr/modeling/necks/db_fpn.py:523 — ppocr/modeling/necks/db_fpn.py:523-544 | ppocr/modeling/necks/db_fpn.py:912-933 — both copies are in the same file, so extract the 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 `ppocr/modeling/necks/db_fpn.py:523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) ppocr/utils/e2e_metric/Deteval.py:547 — ppocr/utils/e2e_metric/Deteval.py:547-568 | ppocr/utils/e2e_metric/Deteval.py:641-662 — both copies are in the same file, so extract the 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 `ppocr/utils/e2e_metric/Deteval.py:547` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) REDACTED:107 — REDACTED:107-128 | REDACTED:338-359 — both copies are in the same file, so extract the 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 `REDACTED:107` 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 (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) ppocr/data/imaug/pg_process.py:668 — ppocr/data/imaug/pg_process.py:668-686 | ppocr/data/imaug/sast_process.py:453-471 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:668` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) ppocr/modeling/backbones/kie_unet_sdmgr.py:30 — ppocr/modeling/backbones/kie_unet_sdmgr.py:30-48 | ppocr/modeling/backbones/kie_unet_sdmgr.py:65-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 (19 lines × 2) ppocr/utils/e2e_metric/Deteval.py:25 — ppocr/utils/e2e_metric/Deteval.py:25-43 | ppocr/utils/e2e_metric/Deteval.py:179-197 — both copies are in the same file, so extract the 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) ppocr/modeling/heads/rec_ppformulanet_head.py:210 — ppocr/modeling/heads/rec_ppformulanet_head.py:210-227 | ppocr/modeling/heads/rec_unimernet_head.py:351-367 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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) ppocr/modeling/heads/rec_ppformulanet_head.py:791 — ppocr/modeling/heads/rec_ppformulanet_head.py:791-807 | ppocr/modeling/heads/rec_unimernet_head.py:2118-2135 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_unimernet_head.py:2118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–18 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:427 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:427-444 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:605-621 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 (10–12 lines × 2) · ×3
  • Duplicated block (10–12 lines × 2) ppocr/data/imaug/pg_process.py:553 — ppocr/data/imaug/pg_process.py:553-564 | ppocr/data/imaug/sast_process.py:325-334 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:553` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) ppocr/data/pgnet_dataset.py:33 — ppocr/data/pgnet_dataset.py:33-42 | ppocr/data/pubtab_dataset.py:33-44 — 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–12 lines × 2) tools/infer_rec.py:125 — tools/infer_rec.py:125-136 | tools/infer_sr.py:65-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×3
  • Duplicated block (10–11 lines × 2) ppocr/data/imaug/pg_process.py:991 — ppocr/data/imaug/pg_process.py:991-1000 | ppocr/data/imaug/sast_process.py:723-733 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:991` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 2) ppocr/postprocess/rec_postprocess.py:1024 — ppocr/postprocess/rec_postprocess.py:1024-1034 | ppocr/postprocess/rec_postprocess.py:1207-1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10–11 lines × 2) ppocr/postprocess/sast_postprocess.py:296 — ppocr/postprocess/sast_postprocess.py:296-306 | ppocr/utils/e2e_utils/pgnet_pp_utils.py:132-141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/postprocess/sast_postprocess.py:296` 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 (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) deploy/slim/quantization/export_model.py:76 — deploy/slim/quantization/export_model.py:76-85 | deploy/slim/quantization/quant.py:110-119 | tools/train.py:81-90 — before extracting anything, compare `deploy/slim/quantization/export_model.py` and `deploy/slim/quantization/quant.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 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 lines × 3) ppocr/modeling/backbones/det_resnet_vd.py:341 — ppocr/modeling/backbones/det_resnet_vd.py:341-350 | ppocr/modeling/backbones/det_resnet_vd_sast.py:286-295 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:266-275 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 8 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet_vd.py:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) REDACTED:1630 — REDACTED:1630-1639 | REDACTED:1688-1697 | ppocr/modeling/backbones/rec_vary_vit.py:591-600 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/modeling/backbones/rec_vary_vit.py:587` calls `Linear` and `REDACTED:1627` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×3
  • Duplicated block (9–10 lines × 2) REDACTED:478 — REDACTED:478-487 | tools/infer/predict_rec.py:417-425 — 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) ppocr/modeling/heads/rec_robustscanner_head.py:228 — ppocr/modeling/heads/rec_robustscanner_head.py:228-236 | ppocr/modeling/heads/rec_robustscanner_head.py:306-315 — both copies are in the same file, so extract the block into 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) REDACTED:223 — REDACTED:223-232 | REDACTED:162-170 — before extracting anything, compare `REDACTED` and `REDACTED` 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:234` calls `info` and `REDACTED:171` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×3
  • Duplicated block (8–9 lines × 3) deploy/slim/quantization/export_model.py:119 — deploy/slim/quantization/export_model.py:119-127 | deploy/slim/quantization/quant.py:153-160 | tools/train.py:136-144 — before extracting anything, compare `deploy/slim/quantization/export_model.py` and `deploy/slim/quantization/quant.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 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–9 lines × 3) mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:117 — mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:117-124 | mcp_server/paddleocr_mcp/inference/ocr/local.py:114-122 | mcp_server/paddleocr_mcp/inference/shared/http_result_parsers.py:31-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. Read the line range as the matched WINDOW rather than a finished unit: at `mcp_server/paddleocr_mcp/inference/ocr/aistudio.py:117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 3) tools/infer_det.py:94 — tools/infer_det.py:94-102 | tools/infer_e2e.py:133-140 | tools/infer_table.py:85-93 — before extracting anything, compare `tools/infer_det.py` and `tools/infer_e2e.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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 × 4) · ×3
  • Duplicated block (8 lines × 4) deploy/avh/convert_image.py:34 — deploy/avh/convert_image.py:34-41 | REDACTED:637-644 | REDACTED:474-482 | tools/infer/predict_rec.py:438-445 — before extracting anything, compare `deploy/avh/convert_image.py` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:474` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) ppocr/losses/rec_att_loss.py:31 — ppocr/losses/rec_att_loss.py:31-38 | ppocr/losses/rec_sar_loss.py:24-31 | ppocr/losses/rec_satrn_loss.py:41-48 | ppocr/losses/rec_spin_att_loss.py:40-47 — before extracting anything, compare `ppocr/losses/rec_sar_loss.py` and `ppocr/losses/rec_satrn_loss.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 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) ppocr/modeling/backbones/det_resnet.py:178 — ppocr/modeling/backbones/det_resnet.py:178-185 | ppocr/modeling/backbones/det_resnet_vd_sast.py:254-261 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:234-241 | ppocr/modeling/backbones/rec_resnet_fpn.py:54-61 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet.py:178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×3
  • Duplicated block (7–8 lines × 2) ppocr/modeling/transforms/gaspin_transformer.py:157 — ppocr/modeling/transforms/gaspin_transformer.py:157-164 | ppocr/modeling/transforms/gaspin_transformer.py:174-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) ppocr/utils/formula_utils/unimernet_data_convert.py:27 — ppocr/utils/formula_utils/unimernet_data_convert.py:27-33 | ppocr/utils/formula_utils/unimernet_data_convert.py:54-61 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/utils/formula_utils/unimernet_data_convert.py:34` calls `join` and `ppocr/utils/formula_utils/unimernet_data_convert.py:62` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–8 lines × 2) tools/infer_cls.py:66 — tools/infer_cls.py:66-73 | tools/infer_e2e.py:131-137 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/infer_e2e.py:138` calls `expand_dims` and `tools/infer_cls.py:74` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) ppocr/losses/distillation_loss.py:763 — ppocr/losses/distillation_loss.py:763-769 | ppocr/losses/distillation_loss.py:823-829 | ppocr/losses/distillation_loss.py:902-908 — 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) ppocr/modeling/backbones/det_resnet_vd.py:334 — ppocr/modeling/backbones/det_resnet_vd.py:334-340 | ppocr/modeling/backbones/det_resnet_vd_sast.py:278-284 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:258-264 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 8 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/backbones/det_resnet_vd_sast.py:285` calls `str`, `chr` and `ppocr/modeling/backbones/det_resnet_vd.py:341` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) REDACTED:118 — REDACTED:118-124 | REDACTED:216-222 | REDACTED:349-355 — 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 lines × 4) · ×3
  • Duplicated block (6 lines × 4) ppocr/data/imaug/east_process.py:311 — ppocr/data/imaug/east_process.py:311-316 | ppocr/data/imaug/fce_aug.py:218-223 | ppocr/data/imaug/pg_process.py:177-182 | ppocr/data/imaug/sast_process.py:154-159 — 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 (6 lines × 4) paddleocr/_pipelines/formula_recognition.py:49 — paddleocr/_pipelines/formula_recognition.py:49-54 | paddleocr/_pipelines/pp_chatocrv4_doc.py:73-78 | paddleocr/_pipelines/pp_doctranslation.py:93-98 | paddleocr/_pipelines/table_recognition_v2.py:61-66 — before extracting anything, compare `paddleocr/_pipelines/formula_recognition.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 134 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) REDACTED:113 — REDACTED:113-118 | ppocr/modeling/backbones/rec_svtrv2.py:80-85 | REDACTED:80-85 | REDACTED:90-95 — before extracting anything, compare `REDACTED` and `ppocr/modeling/backbones/rec_svtrv2.py` as WHOLE FILES: this scan already matched 5 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) ppocr/data/collate_fn.py:32 — ppocr/data/collate_fn.py:32-37 | ppocr/data/collate_fn.py:52-57 | tools/infer_kie_token_ser.py:50-55 — 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) ppocr/data/imaug/pg_process.py:509 — ppocr/data/imaug/pg_process.py:509-514 | ppocr/data/imaug/sast_process.py:290-295 | ppocr/data/imaug/sast_process.py:367-372 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:509` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) tools/infer_cls.py:67 — tools/infer_cls.py:67-73 | tools/infer_det.py:93-99 | tools/infer_e2e.py:132-137 — before extracting anything, compare `tools/infer_det.py` and `tools/infer_e2e.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/infer_det.py:100` calls `expand_dims` and `tools/infer_cls.py:74` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) ppocr/modeling/backbones/table_master_resnet.py:268 — ppocr/modeling/backbones/table_master_resnet.py:268-272 | ppocr/modeling/backbones/table_master_resnet.py:275-279 | ppocr/modeling/backbones/table_master_resnet.py:284-288 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/table_master_resnet.py:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/backbones/table_master_resnet.py:281` calls `Conv2D` and `ppocr/modeling/backbones/table_master_resnet.py:273` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) ppocr/modeling/backbones/det_resnet_vd.py:149 — ppocr/modeling/backbones/det_resnet_vd.py:149-153 | ppocr/modeling/backbones/det_resnet_vd_sast.py:69-73 | ppocr/modeling/backbones/rec_resnet_vd.py:69-73 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 8 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (5 lines × 3) ppocr/modeling/backbones/rec_donut_swin.py:122 — ppocr/modeling/backbones/rec_donut_swin.py:122-126 | ppocr/modeling/backbones/rec_donut_swin.py:157-161 | ppocr/modeling/heads/rec_unimernet_head.py:126-130 — 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. 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.
R10 · Code Duplication · Duplicated block (9 lines × 2 locations) · ×3
  • Duplicated block (9 lines × 2 locations) api_sdk/typescript/src/client.ts:354 — api_sdk/typescript/src/client.ts:354 · api_sdk/typescript/src/internal/poller.ts:150 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
  • Duplicated block (9 lines × 2 locations) api_sdk/typescript/src/internal/http.ts:116 — api_sdk/typescript/src/internal/http.ts:116 · api_sdk/typescript/src/internal/http.ts:126 — both copies are in the same file, so extract the block into 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 locations) paddleocr-js/packages/core/src/viz/ocr/renderer.ts:47 — paddleocr-js/packages/core/src/viz/ocr/renderer.ts:47 · paddleocr-js/packages/core/src/viz/ocr/renderer.ts:57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D17 · Explicit Debt · HackComment · ×2
  • HackComment paddleocr/_pipelines/pp_doctranslation.py:323 — # HACK: We should consider reducing duplication. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment tools/infer/utility.py:460 — # HACK — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D17 · Explicit Debt · FixmeComment · ×2
  • FixmeComment paddleocr/_pipelines/pp_doctranslation.py:902 — # FIXME: Passing API key through CLI is not secure; consider using — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment paddleocr/_pipelines/pp_chatocrv4_doc.py:671 — # FIXME: Passing API key through CLI is not secure; consider using — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D17 · Explicit Debt · XxxComment · ×2
  • XxxComment REDACTED:71 — # XXX: `term_mp` kills all processes in the process group, which in — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment tools/infer/utility.py:488 — # XXX: Currently we have no way to get the data type of the tensor — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · DistillationKLDivLoss.forward (cognitive 31) · ×2
  • DistillationKLDivLoss.forward (cognitive 31) ppocr/losses/distillation_loss.py:197 — DistillationKLDivLoss.forward has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (13 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (DistillationDMLLoss.forward, DistillationDKDLoss.forward, DistillationKLDivLoss.forward, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • DistillationKLDivLoss.forward (cognitive 31) ppocr/losses/distillation_loss.py:451 — DistillationKLDivLoss.forward has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (13 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (DistillationDMLLoss.forward, DistillationKLDivLoss.forward, DistillationDKDLoss.forward, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · DistillationDKDLoss.forward (cognitive 31) · ×2
  • DistillationDKDLoss.forward (cognitive 31) ppocr/losses/distillation_loss.py:305 — DistillationDKDLoss.forward has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (13 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (DistillationDMLLoss.forward, DistillationKLDivLoss.forward, DistillationKLDivLoss.forward, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
  • DistillationDKDLoss.forward (cognitive 31) ppocr/losses/distillation_loss.py:559 — DistillationDKDLoss.forward has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (13 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (DistillationDMLLoss.forward, DistillationKLDivLoss.forward, DistillationDKDLoss.forward, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 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.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyFields · ×2
  • TooManyFields: PPStructureV3Options api_sdk/go/models.go:66 — TooManyFields — 32 stored fields beside 1 method. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: PaddleOCRVLOptions api_sdk/go/models.go:101 — TooManyFields — 31 stored fields beside 1 method. 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.
D36 · Supply-chain Provenance & Signing REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×2
  • Duplicated block (33 lines × 2) ppocr/modeling/heads/rec_att_head.py:49 — ppocr/modeling/heads/rec_att_head.py:49-81 | ppocr/modeling/heads/rec_spin_att_head.py:56-88 — before extracting anything, compare `ppocr/modeling/heads/rec_att_head.py` and `ppocr/modeling/heads/rec_spin_att_head.py` 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. 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 (33 lines × 2) ppocr/postprocess/rec_postprocess.py:708 — ppocr/postprocess/rec_postprocess.py:708-740 | ppocr/postprocess/rec_postprocess.py:783-815 — both copies are in the same file, so extract the 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 × 2) · ×2
  • Duplicated block (32 lines × 2) ppocr/data/imaug/pg_process.py:848 — ppocr/data/imaug/pg_process.py:848-879 | ppocr/data/imaug/sast_process.py:626-657 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (32 lines × 2) REDACTED:597 — REDACTED:597-628 | tools/infer/predict_rec.py:360-391 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×2
  • Duplicated block (27–28 lines × 2) paddleocr/_pipelines/doc_preprocessor.py:116 — paddleocr/_pipelines/doc_preprocessor.py:116-142 | paddleocr/_pipelines/paddleocr_vl.py:386-413 — before extracting anything, compare `paddleocr/_pipelines/doc_preprocessor.py` and `paddleocr/_pipelines/paddleocr_vl.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/doc_preprocessor.py:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27–28 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:501 — ppocr/modeling/heads/rec_ppformulanet_head.py:501-528 | ppocr/modeling/heads/rec_unimernet_head.py:1076-1102 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) tools/program.py:619 — tools/program.py:619-646 | tools/program.py:658-685 — both copies are in the same file, so extract the 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/program.py:619` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (28 lines × 2) ppocr/utils/e2e_metric/Deteval.py:125 — ppocr/utils/e2e_metric/Deteval.py:125-152 | ppocr/utils/e2e_metric/Deteval.py:256-283 — both copies are in the same file, so extract the 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–27 lines × 2) · ×2
  • Duplicated block (26–27 lines × 2) ppocr/data/imaug/pg_process.py:504 — ppocr/data/imaug/pg_process.py:504-529 | ppocr/data/imaug/sast_process.py:285-311 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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.
  • Duplicated block (26–27 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:941 — ppocr/modeling/heads/rec_ppformulanet_head.py:941-966 | ppocr/modeling/heads/rec_unimernet_head.py:2383-2409 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 (24 lines × 3) · ×2
  • Duplicated block (24 lines × 3) paddleocr/_pipelines/formula_recognition.py:240 — paddleocr/_pipelines/formula_recognition.py:240-263 | paddleocr/_pipelines/pp_chatocrv4_doc.py:593-616 | paddleocr/_pipelines/seal_recognition.py:326-349 — before extracting anything, compare `paddleocr/_pipelines/formula_recognition.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/formula_recognition.py:240` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 3) ppocr/utils/e2e_utils/extract_textpoint_fast.py:341 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:341-364 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:77-100 | ppocr/utils/e2e_utils/visual.py:134-157 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/utils/e2e_utils/extract_textpoint_fast.py:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20 lines × 3) · ×2
  • Duplicated block (20 lines × 3) paddleocr/_pipelines/paddleocr_vl.py:427 — paddleocr/_pipelines/paddleocr_vl.py:427-446 | paddleocr/_pipelines/pp_doctranslation.py:884-906 | paddleocr/_pipelines/pp_structurev3.py:1002-1022 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_doctranslation.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 301 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:427` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 3) ppocr/modeling/backbones/det_resnet_vd_sast.py:39 — ppocr/modeling/backbones/det_resnet_vd_sast.py:39-58 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:39-58 | ppocr/modeling/necks/pg_fpn.py:37-56 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 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 (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:333 — ppocr/modeling/heads/rec_ppformulanet_head.py:333-352 | ppocr/modeling/heads/rec_unimernet_head.py:450-468 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (19–20 lines × 2) ppstructure/table/predict_structure.py:130 — ppstructure/table/predict_structure.py:130-148 | tools/infer/predict_det.py:258-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) ppocr/modeling/heads/det_db_head.py:116 — ppocr/modeling/heads/det_db_head.py:116-133 | ppocr/modeling/necks/db_fpn.py:774-789 — 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–18 lines × 2) ppocr/modeling/heads/local_graph.py:337 — ppocr/modeling/heads/local_graph.py:337-352 | ppocr/modeling/heads/proposal_local_graph.py:382-399 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/proposal_local_graph.py:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×2
  • Duplicated block (16 lines × 4) paddleocr/_pipelines/paddleocr_vl.py:186 — paddleocr/_pipelines/paddleocr_vl.py:186-201 | paddleocr/_pipelines/pp_structurev3.py:261-276 | paddleocr/_pipelines/seal_recognition.py:146-161 | paddleocr/_pipelines/table_recognition_v2.py:143-158 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_structurev3.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 354 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 4) ppocr/modeling/backbones/det_resnet_vd_sast.py:50 — ppocr/modeling/backbones/det_resnet_vd_sast.py:50-65 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:50-65 | ppocr/modeling/backbones/rec_resnet_vd.py:50-65 | ppocr/modeling/necks/pg_fpn.py:48-63 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet_vd_sast.py:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×2
  • Duplicated block (14–16 lines × 2) ppocr/data/imaug/iaa_augment.py:95 — ppocr/data/imaug/iaa_augment.py:95-110 | ppocr/data/imaug/iaa_augment.py:115-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–16 lines × 2) REDACTED:256 — REDACTED:256-269 | REDACTED:153-168 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) REDACTED:144 — REDACTED:144-159 | REDACTED:122-136 — before extracting anything, compare `REDACTED` and `REDACTED` 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) ppocr/utils/e2e_utils/pgnet_pp_utils.py:48 — ppocr/utils/e2e_utils/pgnet_pp_utils.py:48-63 | ppocr/utils/e2e_utils/pgnet_pp_utils.py:89-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×2
  • Duplicated block (14–15 lines × 3) ppocr/data/imaug/east_process.py:336 — ppocr/data/imaug/east_process.py:336-350 | ppocr/data/imaug/pg_process.py:197-210 | ppocr/data/imaug/sast_process.py:177-190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 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.
  • Duplicated block (14–15 lines × 3) REDACTED:132 — REDACTED:132-146 | REDACTED:245-258 | REDACTED:366-379 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×2
  • Duplicated block (13–15 lines × 2) ppocr/data/imaug/drrg_targets.py:373 — ppocr/data/imaug/drrg_targets.py:373-387 | ppocr/data/imaug/fce_targets.py:351-363 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/drrg_targets.py:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–15 lines × 2) ppocr/data/imaug/pg_process.py:951 — ppocr/data/imaug/pg_process.py:951-963 | ppocr/data/imaug/sast_process.py:696-710 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) REDACTED:1679 — REDACTED:1679-1692 | REDACTED:1698-1712 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) REDACTED:163 — REDACTED:163-176 | REDACTED:180-194 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Callable` names `collections` in one and `collections.abc` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) paddleocr/_pipelines/paddleocr_vl.py:129 — paddleocr/_pipelines/paddleocr_vl.py:129-142 | paddleocr/_pipelines/pp_structurev3.py:186-199 | paddleocr/_pipelines/seal_recognition.py:107-120 | paddleocr/_pipelines/table_recognition_v2.py:96-109 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_structurev3.py` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 354 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 4) ppocr/modeling/necks/db_fpn.py:271 — ppocr/modeling/necks/db_fpn.py:271-284 | ppocr/modeling/necks/db_fpn.py:386-399 | ppocr/modeling/necks/db_fpn.py:509-522 | ppocr/modeling/necks/db_fpn.py:898-911 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:271` 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 × 3) · ×2
  • Duplicated block (13–14 lines × 3) ppocr/data/imaug/unimernet_aug.py:565 — ppocr/data/imaug/unimernet_aug.py:565-578 | ppocr/data/imaug/unimernet_aug.py:705-718 | ppocr/data/imaug/unimernet_aug.py:804-816 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13–14 lines × 3) ppocr/modeling/heads/det_sast_head.py:42 — ppocr/modeling/heads/det_sast_head.py:42-55 | ppocr/modeling/necks/sast_fpn.py:41-54 | ppocr/modeling/necks/sast_fpn.py:82-94 — before extracting anything, compare `ppocr/modeling/heads/det_sast_head.py` and `ppocr/modeling/necks/sast_fpn.py` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_sast_head.py:42` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:676 — ppocr/modeling/heads/rec_ppformulanet_head.py:676-689 | ppocr/modeling/heads/rec_unimernet_head.py:841-855 | ppocr/modeling/heads/rec_unimernet_head.py:2009-2022 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:676` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:197 — deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:197-210 | deploy/ios_demo/PaddleOCRDemo/Engine/QuadTextCrop.swift:120-133 | deploy/ios_demo/PaddleOCRDemo/Engine/RecPreprocessor.swift:256-269 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/ios_demo/PaddleOCRDemo/Engine/Preprocessing.swift:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) deploy/avh/convert_image.py:30 — deploy/avh/convert_image.py:30-41 | REDACTED:469-482 — 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–14 lines × 2) REDACTED:372 — REDACTED:372-383 | ppocr/utils/e2e_utils/visual.py:75-88 — before extracting anything, compare `REDACTED` and `ppocr/utils/e2e_utils/visual.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (13–14 lines × 2) · ×2
  • Duplicated block (13–14 lines × 2) paddleocr/_doc2md/converters/docx.py:1110 — paddleocr/_doc2md/converters/docx.py:1110-1123 | paddleocr/_doc2md/converters/pptx.py:424-436 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_doc2md/converters/docx.py:1110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_slow.py:367 — ppocr/utils/e2e_utils/extract_textpoint_slow.py:367-379 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:423-436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) REDACTED:54 — REDACTED:54-66 | REDACTED:215-227 | REDACTED:251-263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:69` calls `expand_points_num` and `REDACTED:228` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:595 — ppocr/modeling/heads/rec_ppformulanet_head.py:595-610 | ppocr/modeling/heads/rec_unimernet_head.py:1166-1178 | ppocr/modeling/heads/rec_unimernet_head.py:1842-1856 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) ppocr/modeling/necks/db_fpn.py:121 — ppocr/modeling/necks/db_fpn.py:121-133 | ppocr/modeling/necks/table_fpn.py:29-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) tools/program.py:541 — tools/program.py:541-552 | tools/program.py:585-597 — both copies are in the same file, so extract the 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/program.py:541` 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 (11–12 lines × 4) · ×2
  • Duplicated block (11–12 lines × 4) REDACTED:878 — REDACTED:878-889 | REDACTED:927-938 | ppocr/postprocess/rec_postprocess.py:693-703 | ppocr/postprocess/rec_postprocess.py:768-778 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11–12 lines × 4) ppocr/modeling/heads/rec_ppformulanet_head.py:1165 — ppocr/modeling/heads/rec_ppformulanet_head.py:1165-1176 | ppocr/modeling/heads/rec_ppformulanet_head.py:1280-1291 | ppocr/modeling/heads/rec_unimernet_head.py:2476-2487 | ppocr/modeling/heads/rec_unimernet_head.py:2561-2571 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 (12 lines × 4) · ×2
  • Duplicated block (12 lines × 4) ppocr/losses/det_sast_loss.py:61 — ppocr/losses/det_sast_loss.py:61-72 | ppocr/losses/det_sast_loss.py:82-93 | ppocr/losses/det_sast_loss.py:103-114 | ppocr/losses/e2e_pg_loss.py:48-59 — 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 (12 lines × 4) ppocr/postprocess/sast_postprocess.py:90 — ppocr/postprocess/sast_postprocess.py:90-101 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:347-358 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:83-94 | ppocr/utils/e2e_utils/visual.py:140-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/postprocess/sast_postprocess.py:90` 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 (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) ppocr/modeling/backbones/det_pp_lcnet.py:252 — ppocr/modeling/backbones/det_pp_lcnet.py:252-262 | ppocr/modeling/backbones/rec_lcnetv3.py:543-554 — before extracting anything, compare `ppocr/modeling/backbones/det_pp_lcnet.py` and `ppocr/modeling/backbones/rec_lcnetv3.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 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–12 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1076 — ppocr/modeling/heads/rec_ppformulanet_head.py:1076-1087 | ppocr/modeling/heads/rec_unimernet_head.py:2508-2518 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 × 9) · ×2
  • Duplicated block (11 lines × 9) deploy/hubserving/kie_ser/module.py:76 — deploy/hubserving/kie_ser/module.py:76-86 | deploy/hubserving/kie_ser_re/module.py:76-86 | deploy/hubserving/ocr_cls/module.py:72-82 | deploy/hubserving/ocr_det/module.py:74-84 | deploy/hubserving/ocr_rec/module.py:72-82 | deploy/hubserving/ocr_system/module.py:75-85 | deploy/hubserving/structure_layout/module.py:71-81 | deploy/hubserving/structure_system/module.py:74-84 | deploy/hubserving/structure_table/module.py:73-83 — `deploy/hubserving/kie_ser/module.py` and `deploy/hubserving/kie_ser_re/module.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 9) deploy/hubserving/kie_ser/module.py:89 — deploy/hubserving/kie_ser/module.py:89-99 | deploy/hubserving/kie_ser_re/module.py:89-99 | deploy/hubserving/ocr_cls/module.py:85-95 | deploy/hubserving/ocr_det/module.py:87-97 | deploy/hubserving/ocr_rec/module.py:85-95 | deploy/hubserving/ocr_system/module.py:88-98 | deploy/hubserving/structure_layout/module.py:84-94 | deploy/hubserving/structure_system/module.py:87-97 | deploy/hubserving/structure_table/module.py:86-96 — `deploy/hubserving/kie_ser/module.py` and `deploy/hubserving/kie_ser_re/module.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 64 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×2
  • Duplicated block (11 lines × 5) ppocr/losses/distillation_loss.py:89 — ppocr/losses/distillation_loss.py:89-99 | ppocr/losses/distillation_loss.py:185-195 | ppocr/losses/distillation_loss.py:293-303 | ppocr/losses/distillation_loss.py:439-449 | ppocr/losses/distillation_loss.py:547-557 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 5) ppocr/modeling/backbones/det_pp_lcnet.py:182 — ppocr/modeling/backbones/det_pp_lcnet.py:182-192 | ppocr/modeling/backbones/det_pp_lcnet.py:195-205 | ppocr/modeling/backbones/det_pp_lcnet.py:208-218 | ppocr/modeling/backbones/det_pp_lcnet.py:221-231 | ppocr/modeling/backbones/det_pp_lcnet.py:234-244 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_pp_lcnet.py:182` 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 (9–10 lines × 4) · ×2
  • Duplicated block (9–10 lines × 4) ppocr/data/imaug/pg_process.py:98 — ppocr/data/imaug/pg_process.py:98-107 | ppocr/data/imaug/pg_process.py:689-697 | ppocr/data/imaug/sast_process.py:77-86 | ppocr/data/imaug/sast_process.py:474-482 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 4) ppocr/postprocess/rec_postprocess.py:325 — ppocr/postprocess/rec_postprocess.py:325-333 | ppocr/postprocess/rec_postprocess.py:398-406 | ppocr/postprocess/rec_postprocess.py:744-753 | ppocr/postprocess/rec_postprocess.py:819-828 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/postprocess/rec_postprocess.py:395` calls `isinstance` and `ppocr/postprocess/rec_postprocess.py:742` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) ppocr/postprocess/sast_postprocess.py:79 — ppocr/postprocess/sast_postprocess.py:79-88 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:336-345 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:72-81 | ppocr/utils/e2e_utils/visual.py:129-138 — 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 (10 lines × 4) ppocr/utils/e2e_utils/extract_textpoint_fast.py:233 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:233-242 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:284-293 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:261-270 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:313-322 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×2
  • Duplicated block (9 lines × 5) ppocr/modeling/backbones/det_resnet.py:135 — ppocr/modeling/backbones/det_resnet.py:135-143 | ppocr/modeling/backbones/det_resnet_vd.py:269-277 | ppocr/modeling/backbones/det_resnet_vd_sast.py:196-204 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:194-202 | ppocr/modeling/backbones/rec_resnet_vd.py:197-205 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 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 × 5) ppocr/modeling/necks/db_fpn.py:195 — ppocr/modeling/necks/db_fpn.py:195-203 | ppocr/modeling/necks/db_fpn.py:278-286 | ppocr/modeling/necks/db_fpn.py:393-401 | ppocr/modeling/necks/db_fpn.py:516-524 | ppocr/modeling/necks/db_fpn.py:905-913 — 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 (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) ppocr/modeling/transforms/tbsrn.py:272 — ppocr/modeling/transforms/tbsrn.py:272-280 | ppocr/modeling/transforms/tsrn.py:149-156 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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–9 lines × 2) tools/program.py:349 — tools/program.py:349-357 | tools/program.py:746-753 — both copies are in the same file, so extract the 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/program.py:349` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×2
  • Duplicated block (7–9 lines × 2) ppstructure/kie/predict_kie_token_ser.py:179 — ppstructure/kie/predict_kie_token_ser.py:179-187 | ppstructure/table/predict_structure.py:195-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. Read the line range as the matched WINDOW rather than a finished unit: at `ppstructure/kie/predict_kie_token_ser.py:179` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppstructure/table/predict_structure.py:203` calls `report` and `ppstructure/kie/predict_kie_token_ser.py:190` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–9 lines × 2) ppocr/losses/e2e_pg_loss.py:38 — ppocr/losses/e2e_pg_loss.py:38-44 | ppocr/losses/e2e_pg_loss.py:63-71 — both copies are in the same file, so extract the 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 × 5) · ×2
  • Duplicated block (8 lines × 5) deploy/avh/convert_image.py:44 — deploy/avh/convert_image.py:44-51 | REDACTED:647-654 | REDACTED:674-681 | tools/infer/predict_cls.py:79-86 | tools/infer/predict_rec.py:448-455 — before extracting anything, compare `deploy/avh/convert_image.py` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 5) ppocr/losses/distillation_loss.py:103 — ppocr/losses/distillation_loss.py:103-110 | ppocr/losses/distillation_loss.py:199-206 | ppocr/losses/distillation_loss.py:308-315 | ppocr/losses/distillation_loss.py:453-460 | ppocr/losses/distillation_loss.py:562-569 — 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 (7 lines × 7) · ×2
  • Duplicated block (7 lines × 7) REDACTED:590 — REDACTED:590-596 | ppocr/modeling/backbones/rec_svtrv2.py:563-569 | REDACTED:252-258 | REDACTED:293-299 | REDACTED:110-116 | REDACTED:287-293 | ppocr/modeling/necks/rnn.py:208-214 — before extracting anything, compare `REDACTED` and `ppocr/modeling/backbones/rec_svtrv2.py` as WHOLE FILES: this scan already matched 5 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 × 7) REDACTED:490 — REDACTED:490-496 | REDACTED:548-554 | REDACTED:628-634 | ppocr/postprocess/rec_postprocess.py:341-347 | ppocr/postprocess/rec_postprocess.py:428-434 | ppocr/postprocess/rec_postprocess.py:455-461 | ppocr/postprocess/rec_postprocess.py:583-589 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) deploy/avh/convert_image.py:36 — deploy/avh/convert_image.py:36-42 | REDACTED:639-645 | REDACTED:477-483 | tools/infer/predict_cls.py:71-77 | tools/infer/predict_rec.py:440-446 — before extracting anything, compare `deploy/avh/convert_image.py` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 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 × 5) ppocr/postprocess/rec_postprocess.py:324 — ppocr/postprocess/rec_postprocess.py:324-331 | ppocr/postprocess/rec_postprocess.py:397-404 | ppocr/postprocess/rec_postprocess.py:743-751 | ppocr/postprocess/rec_postprocess.py:818-826 | ppocr/postprocess/rec_postprocess.py:952-958 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/postprocess/rec_postprocess.py:395` calls `isinstance` and `ppocr/postprocess/rec_postprocess.py:742` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×2
  • Duplicated block (6–7 lines × 3) ppocr/data/imaug/east_process.py:312 — ppocr/data/imaug/east_process.py:312-318 | ppocr/data/imaug/pg_process.py:178-183 | ppocr/data/imaug/sast_process.py:155-160 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6–7 lines × 3) REDACTED:164 — REDACTED:164-170 | REDACTED:280-286 | REDACTED:414-419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) ppocr/modeling/transforms/tbsrn.py:146 — ppocr/modeling/transforms/tbsrn.py:146-152 | ppocr/modeling/transforms/tsrn.py:52-57 — before extracting anything, compare `ppocr/modeling/transforms/tbsrn.py` and `ppocr/modeling/transforms/tsrn.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/transforms/tbsrn.py:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6–7 lines × 2) ppocr/utils/e2e_metric/Deteval.py:345 — ppocr/utils/e2e_metric/Deteval.py:345-350 | ppocr/utils/e2e_metric/Deteval.py:406-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/utils/e2e_metric/Deteval.py:344` calls `enumerate` and `ppocr/utils/e2e_metric/Deteval.py:404` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) ppocr/modeling/backbones/det_resnet.py:179 — ppocr/modeling/backbones/det_resnet.py:179-184 | ppocr/modeling/backbones/det_resnet_vd_sast.py:255-260 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:235-240 | ppocr/modeling/backbones/rec_resnet_fpn.py:55-60 | ppocr/modeling/backbones/rec_resnet_vd.py:248-253 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 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 × 5) ppocr/modeling/backbones/det_mobilenet_v3.py:29 — ppocr/modeling/backbones/det_mobilenet_v3.py:29-34 | ppocr/modeling/backbones/det_pp_lcnet.py:69-74 | ppocr/modeling/backbones/det_pp_lcnet_v2.py:45-50 | ppocr/modeling/backbones/rec_lcnetv3.py:82-87 | test_tipc/supplementary/mv3.py:40-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_mobilenet_v3.py:29` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) paddleocr/_doc2md/converters/docx.py:1008 — paddleocr/_doc2md/converters/docx.py:1008-1012 | paddleocr/_doc2md/converters/docx.py:1017-1021 | paddleocr/_doc2md/converters/pptx.py:365-369 | paddleocr/_doc2md/converters/pptx.py:376-380 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `paddleocr/_doc2md/converters/pptx.py:372` calls `find` and `paddleocr/_doc2md/converters/docx.py:1015` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) ppocr/postprocess/sast_postprocess.py:60 — ppocr/postprocess/sast_postprocess.py:60-64 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:320-324 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:53-57 | ppocr/utils/e2e_utils/visual.py:110-114 — 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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×2
  • Sync-over-async blocking api_sdk/typescript/src/internal/http.ts:90 — `fs.existsSync` in `submitFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking api_sdk/typescript/src/internal/http.ts:105 — `fs.readFileSync` in `submitFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
R10 · Code Duplication · Duplicated block with local edits (11 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (11 matched lines × 2 locations) paddleocr-js/packages/core/src/platform/browser.ts:37 — paddleocr-js/packages/core/src/platform/browser.ts:37 · paddleocr-js/packages/core/src/platform/browser.ts:58 — the two spans are one implementation copied and then locally edited — 72 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (11 matched lines × 2 locations) paddleocr-js/packages/core/src/viz/ocr/draw-boxes.ts:16 — paddleocr-js/packages/core/src/viz/ocr/draw-boxes.ts:16 · paddleocr-js/packages/core/src/viz/ocr/draw-text.ts:45 — the two spans are one implementation copied and then locally edited — 92 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
C2 · Access Controls · No authorization · ×1
  • No authorization REDACTED:139 — This repository serves requests — a request handler (@app.get() (REDACTED:139) — and no route guard, auth-gate middleware, global guard or imperative check that refuses a caller (401/403, an Unauthorized/Forbidden error) was found: its endpoints may be unprotected.
D1 · Cyclomatic Complexity · program.train (cyclomatic 79) · ×1
  • program.train (cyclomatic 79) tools/program.py:200 — program.train has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent 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 · utility.create_predictor (cyclomatic 60) · ×1
  • utility.create_predictor (cyclomatic 60) tools/infer/utility.py:177 — utility.create_predictor 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.
D1 · Cyclomatic Complexity · CustomMBartDecoder.forward (cyclomatic 55) · ×1
  • CustomMBartDecoder.forward (cyclomatic 55) ppocr/modeling/heads/rec_unimernet_head.py:1663 — CustomMBartDecoder.forward has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent 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 · docx._extract_chart_tables (cyclomatic 53) · ×1
  • docx._extract_chart_tables (cyclomatic 53) paddleocr/_doc2md/converters/docx.py:967 — docx._extract_chart_tables 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.
D1 · Cyclomatic Complexity · CustomMBartDecoder.forward (cyclomatic 53) · ×1
  • CustomMBartDecoder.forward (cyclomatic 53) ppocr/modeling/heads/rec_ppformulanet_head.py:412 — CustomMBartDecoder.forward 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.
D1 · Cyclomatic Complexity · TextRecognizer.__call__ (cyclomatic 52) · ×1
  • TextRecognizer.__call__ (cyclomatic 52) tools/infer/predict_rec.py:583 — TextRecognizer.__call__ 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.
D1 · Cyclomatic Complexity · MBartDecoder.forward (cyclomatic 48) · ×1
  • MBartDecoder.forward (cyclomatic 48) ppocr/modeling/heads/rec_unimernet_head.py:1006 — MBartDecoder.forward 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.
D1 · Cyclomatic Complexity · XlsxConverter.convert_file (cyclomatic 43) · ×1
  • XlsxConverter.convert_file (cyclomatic 43) paddleocr/_doc2md/converters/xlsx.py:162 — XlsxConverter.convert_file 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 · docx._convert_body (cyclomatic 41) · ×1
  • docx._convert_body (cyclomatic 41) paddleocr/_doc2md/converters/docx.py:1288 — docx._convert_body 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.
D1 · Cyclomatic Complexity · infer_rec.main (cyclomatic 38) · ×1
  • infer_rec.main (cyclomatic 38) tools/infer_rec.py:41 — infer_rec.main has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PptxConverter._chart_to_html (cyclomatic 37) · ×1
  • PptxConverter._chart_to_html (cyclomatic 37) paddleocr/_doc2md/converters/pptx.py:344 — PptxConverter._chart_to_html has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PaddleOCR._get_ocr_model_names (cyclomatic 36) · ×1
  • PaddleOCR._get_ocr_model_names (cyclomatic 36) paddleocr/_pipelines/ocr.py:318 — PaddleOCR._get_ocr_model_names has cyclomatic complexity 36 (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 · export_model.dynamic_to_static (cyclomatic 33) · ×1
  • export_model.dynamic_to_static (cyclomatic 33) ppocr/utils/export_model.py:169 — export_model.dynamic_to_static has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PptxConverter._table_to_html (cyclomatic 32) · ×1
  • PptxConverter._table_to_html (cyclomatic 32) paddleocr/_doc2md/converters/pptx.py:459 — PptxConverter._table_to_html has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RandomCrop.__call__ (cyclomatic 32) · ×1
  • RandomCrop.__call__ (cyclomatic 32) ppocr/data/imaug/random_crop_data.py:201 — RandomCrop.__call__ has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · docx._table_to_html (cyclomatic 31) · ×1
  • docx._table_to_html (cyclomatic 31) paddleocr/_doc2md/converters/docx.py:832 — docx._table_to_html 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.
D1 · Cyclomatic Complexity · save_load.load_model (cyclomatic 31) · ×1
  • save_load.load_model (cyclomatic 31) REDACTED:66 — save_load.load_model 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.
D1 · Cyclomatic Complexity · docx._iter_paragraph_items (cyclomatic 30) · ×1
  • docx._iter_paragraph_items (cyclomatic 30) paddleocr/_doc2md/converters/docx.py:358 — docx._iter_paragraph_items has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · train.main (cyclomatic 30) · ×1
  • train.main (cyclomatic 30) tools/train.py:46 — train.main has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DYMicroBlock.__init__ (cyclomatic 29) · ×1
  • DYMicroBlock.__init__ (cyclomatic 29) REDACTED:337 — DYMicroBlock.__init__ has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PGProcessTrain.__call__ (cyclomatic 28) · ×1
  • PGProcessTrain.__call__ (cyclomatic 28) ppocr/data/imaug/pg_process.py:940 — PGProcessTrain.__call__ 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.
D1 · Cyclomatic Complexity · save_load.update_train_results (cyclomatic 28) · ×1
  • save_load.update_train_results (cyclomatic 28) REDACTED:332 — save_load.update_train_results 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 · DetectionIoUEvaluator.evaluate_image (cyclomatic 25) · ×1
  • DetectionIoUEvaluator.evaluate_image (cyclomatic 25) ppocr/metrics/eval_det_iou.py:18 — DetectionIoUEvaluator.evaluate_image has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResNet.__init__ (cyclomatic 25) · ×1
  • ResNet.__init__ (cyclomatic 25) ppocr/modeling/backbones/det_resnet.py:128 — ResNet.__init__ has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · export_model.export (cyclomatic 25) · ×1
  • export_model.export (cyclomatic 25) ppocr/utils/export_model.py:419 — export_model.export has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TextRecognizer.__init__ (cyclomatic 25) · ×1
  • TextRecognizer.__init__ (cyclomatic 25) tools/infer/predict_rec.py:40 — TextRecognizer.__init__ 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 · program.eval (cyclomatic 25) · ×1
  • program.eval (cyclomatic 25) tools/program.py:709 — program.eval has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PptxConverter._process_shape (cyclomatic 24) · ×1
  • PptxConverter._process_shape (cyclomatic 24) paddleocr/_doc2md/converters/pptx.py:233 — PptxConverter._process_shape has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · export_model.dump_infer_config (cyclomatic 24) · ×1
  • export_model.dump_infer_config (cyclomatic 24) ppocr/utils/export_model.py:41 — export_model.dump_infer_config has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Client.SaveResource (cyclomatic 24) · ×1
  • Client.SaveResource (cyclomatic 24) api_sdk/go/resource.go:44 — Client.SaveResource has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · config.normalizeOcrPipelineConfig (cyclomatic 24) · ×1
  • config.normalizeOcrPipelineConfig (cyclomatic 24) paddleocr-js/packages/core/src/pipelines/ocr/config.ts:133 — config.normalizeOcrPipelineConfig has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · docx._runs_to_markdown (cyclomatic 23) · ×1
  • docx._runs_to_markdown (cyclomatic 23) paddleocr/_doc2md/converters/docx.py:618 — docx._runs_to_markdown has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PPStructureV3._get_ocr_model_names (cyclomatic 23) · ×1
  • PPStructureV3._get_ocr_model_names (cyclomatic 23) paddleocr/_pipelines/pp_structurev3.py:530 — PPStructureV3._get_ocr_model_names 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 · ResNet_vd.__init__ (cyclomatic 23) · ×1
  • ResNet_vd.__init__ (cyclomatic 23) ppocr/modeling/backbones/det_resnet_vd.py:262 — ResNet_vd.__init__ has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AttentionLayers.__init__ (cyclomatic 23) · ×1
  • AttentionLayers.__init__ (cyclomatic 23) ppocr/modeling/heads/rec_latexocr_head.py:483 — AttentionLayers.__init__ 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 · eval.main (cyclomatic 23) · ×1
  • eval.main (cyclomatic 23) tools/eval.py:35 — eval.main has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResNet_SAST.__init__ (cyclomatic 22) · ×1
  • ResNet_SAST.__init__ (cyclomatic 22) ppocr/modeling/backbones/det_resnet_vd_sast.py:191 — ResNet_SAST.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResNet.__init__ (cyclomatic 22) · ×1
  • ResNet.__init__ (cyclomatic 22) ppocr/modeling/backbones/rec_resnet_vd.py:192 — ResNet.__init__ has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · eval_end2end.e2e_eval (cyclomatic 22) · ×1
  • eval_end2end.e2e_eval (cyclomatic 22) tools/end2end/eval_end2end.py:70 — eval_end2end.e2e_eval has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · trans_funsd_label.load_funsd_label (cyclomatic 21) · ×1
  • trans_funsd_label.load_funsd_label (cyclomatic 21) ppstructure/kie/tools/trans_funsd_label.py:39 — trans_funsd_label.load_funsd_label 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 · predict_system.main (cyclomatic 21) · ×1
  • predict_system.main (cyclomatic 21) REDACTED:304 — predict_system.main 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 · TextDetector.__call__ (cyclomatic 21) · ×1
  • TextDetector.__call__ (cyclomatic 21) tools/infer/predict_det.py:310 — TextDetector.__call__ 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 · OcrPipelineRunner.predict (cyclomatic 21) · ×1
  • OcrPipelineRunner.predict (cyclomatic 21) paddleocr-js/packages/core/src/pipelines/ocr/core.ts:197 — OcrPipelineRunner.predict has cyclomatic complexity 21 (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 · RandomCropFlip.random_crop_flip (cyclomatic 20) · ×1
  • RandomCropFlip.random_crop_flip (cyclomatic 20) ppocr/data/imaug/fce_aug.py:86 — RandomCropFlip.random_crop_flip 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 · VQATokenLabelEncode.__call__ (cyclomatic 20) · ×1
  • VQATokenLabelEncode.__call__ (cyclomatic 20) REDACTED:1100 — VQATokenLabelEncode.__call__ 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 · TextDetector.__init__ (cyclomatic 20) · ×1
  • TextDetector.__init__ (cyclomatic 20) tools/infer/predict_det.py:37 — TextDetector.__init__ 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 · HttpClient.fetch (cyclomatic 20) · ×1
  • HttpClient.fetch (cyclomatic 20) api_sdk/typescript/src/internal/http.ts:178 — HttpClient.fetch 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 · GenTableMask.projection_cx (cyclomatic 19) · ×1
  • GenTableMask.projection_cx (cyclomatic 19) ppocr/data/imaug/table_ops.py:72 — GenTableMask.projection_cx has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VQATokenPad.__call__ (cyclomatic 19) · ×1
  • VQATokenPad.__call__ (cyclomatic 19) ppocr/data/imaug/vqa/token/vqa_token_pad.py:41 — VQATokenPad.__call__ has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · program.check_device (cyclomatic 19) · ×1
  • program.check_device (cyclomatic 19) tools/program.py:118 — program.check_device 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 · WarpMLS.calc_delta (cyclomatic 18) · ×1
  • WarpMLS.calc_delta (cyclomatic 18) ppocr/data/imaug/text_image_aug/warp_mls.py:43 — WarpMLS.calc_delta 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 · VLLabelDecode.__call__ (cyclomatic 18) · ×1
  • VLLabelDecode.__call__ (cyclomatic 18) ppocr/postprocess/rec_postprocess.py:1090 — VLLabelDecode.__call__ 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 · eval_with_label_end2end.eval_e2e (cyclomatic 18) · ×1
  • eval_with_label_end2end.eval_e2e (cyclomatic 18) ppstructure/kie/tools/eval_with_label_end2end.py:109 — eval_with_label_end2end.eval_e2e 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 · TableMatch.get_pred_html (cyclomatic 18) · ×1
  • TableMatch.get_pred_html (cyclomatic 18) ppstructure/table/matcher.py:104 — TableMatch.get_pred_html 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 · predict_system.main (cyclomatic 18) · ×1
  • predict_system.main (cyclomatic 18) tools/infer/predict_system.py:185 — predict_system.main 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 · quant.main (cyclomatic 17) · ×1
  • quant.main (cyclomatic 17) deploy/slim/quantization/quant.py:89 — quant.main 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 · docx._iter_math_paragraph_parts (cyclomatic 17) · ×1
  • docx._iter_math_paragraph_parts (cyclomatic 17) paddleocr/_doc2md/converters/docx.py:137 — docx._iter_math_paragraph_parts 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 · pptx._format_run_segment (cyclomatic 17) · ×1
  • pptx._format_run_segment (cyclomatic 17) paddleocr/_doc2md/converters/pptx.py:111 — pptx._format_run_segment 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 · RandomCropImgMask.__call__ (cyclomatic 17) · ×1
  • RandomCropImgMask.__call__ (cyclomatic 17) ppocr/data/imaug/random_crop_data.py:533 — RandomCropImgMask.__call__ 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 · SASTProcessTrain.__call__ (cyclomatic 17) · ×1
  • SASTProcessTrain.__call__ (cyclomatic 17) ppocr/data/imaug/sast_process.py:681 — SASTProcessTrain.__call__ has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Attention.forward (cyclomatic 17) · ×1
  • Attention.forward (cyclomatic 17) ppocr/modeling/heads/rec_latexocr_head.py:332 — Attention.forward has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · recovery_to_doc.convert_info_docx (cyclomatic 17) · ×1
  • recovery_to_doc.convert_info_docx (cyclomatic 17) ppstructure/recovery/recovery_to_doc.py:32 — recovery_to_doc.convert_info_docx 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 · TableMatch.get_pred_html_master (cyclomatic 17) · ×1
  • TableMatch.get_pred_html_master (cyclomatic 17) ppstructure/table/matcher.py:151 — TableMatch.get_pred_html_master 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 · UniMERNetLabelEncode.__init__ (cyclomatic 16) · ×1
  • UniMERNetLabelEncode.__init__ (cyclomatic 16) REDACTED:1939 — UniMERNetLabelEncode.__init__ 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 · random_crop_data.clip_poly_to_rect (cyclomatic 16) · ×1
  • random_crop_data.clip_poly_to_rect (cyclomatic 16) ppocr/data/imaug/random_crop_data.py:110 — random_crop_data.clip_poly_to_rect 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 · DonutSwinEncoder.forward (cyclomatic 16) · ×1
  • DonutSwinEncoder.forward (cyclomatic 16) ppocr/modeling/backbones/rec_donut_swin.py:980 — DonutSwinEncoder.forward 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 · AttentionLayers.forward (cyclomatic 16) · ×1
  • AttentionLayers.forward (cyclomatic 16) ppocr/modeling/heads/rec_latexocr_head.py:601 — AttentionLayers.forward 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 · PPFormulaNet_Head._prepare_decoder_input_ids_for_generation (cyclomatic 16) · ×1
  • PPFormulaNet_Head._prepare_decoder_input_ids_for_generation (cyclomatic 16) ppocr/modeling/heads/rec_ppformulanet_head.py:968 — PPFormulaNet_Head._prepare_decoder_input_ids_for_generation 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 · BaseRecLabelDecode.get_word_info (cyclomatic 16) · ×1
  • BaseRecLabelDecode.get_word_info (cyclomatic 16) ppocr/postprocess/rec_postprocess.py:72 — BaseRecLabelDecode.get_word_info 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 · UniMERNetDecode.__init__ (cyclomatic 16) · ×1
  • UniMERNetDecode.__init__ (cyclomatic 16) ppocr/postprocess/rec_postprocess.py:1292 — UniMERNetDecode.__init__ 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 · save_load.save_model (cyclomatic 16) · ×1
  • save_load.save_model (cyclomatic 16) REDACTED:241 — save_load.save_model 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 · program.preprocess (cyclomatic 16) · ×1
  • program.preprocess (cyclomatic 16) tools/program.py:873 — program.preprocess 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 · Client.submitFile (cyclomatic 16) · ×1
  • Client.submitFile (cyclomatic 16) api_sdk/go/transport.go:104 — Client.submitFile 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 · det.decodeDetOutput (cyclomatic 16) · ×1
  • det.decodeDetOutput (cyclomatic 16) paddleocr-js/packages/core/src/models/det.ts:468 — det.decodeDetOutput has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D10 · Test Quality · No assertions · ×1
  • No assertions: dispose() is safe to call multiple times paddleocr-js/packages/core/test/viz-renderer.test.ts: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.
D2 · Cognitive Complexity · program.train (cognitive 173) · ×1
  • program.train (cognitive 173) tools/program.py:200 — program.train has cognitive complexity 173 (threshold 15). Drivers by points: if/else 50 (132 pts), ternaries 9 (23 pts), boolean chains 12, loops 3 (5 pts), error handling 1 (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 · docx._extract_chart_tables (cognitive 163) · ×1
  • docx._extract_chart_tables (cognitive 163) paddleocr/_doc2md/converters/docx.py:967 — docx._extract_chart_tables has cognitive complexity 163 (threshold 15). Drivers by points: if/else 28 (87 pts), ternaries 6 (31 pts), loops 9 (26 pts), error handling 4 (11 pts), boolean chains 8 (nesting depth added 108). 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 · XlsxConverter.convert_file (cognitive 138) · ×1
  • XlsxConverter.convert_file (cognitive 138) paddleocr/_doc2md/converters/xlsx.py:162 — XlsxConverter.convert_file has cognitive complexity 138 (threshold 15). Drivers by points: if/else 20 (77 pts), loops 9 (24 pts), error handling 5 (20 pts), ternaries 4 (13 pts), boolean chains 4 (nesting depth added 96). To reduce it, split the body into named stages: move each independent 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 · utility.create_predictor (cognitive 127) · ×1
  • utility.create_predictor (cognitive 127) tools/infer/utility.py:177 — utility.create_predictor has cognitive complexity 127 (threshold 15). Drivers by points: if/else 46 (106 pts), loops 3 (8 pts), boolean chains 6, error handling 1 (5 pts), ternaries 1 (2 pts) (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TextRecognizer.__call__ (cognitive 117) · ×1
  • TextRecognizer.__call__ (cognitive 117) tools/infer/predict_rec.py:583 — TextRecognizer.__call__ has cognitive complexity 117 (threshold 15). Drivers by points: if/else 29 (66 pts), loops 16 (51 pts) (nesting depth added 72). To reduce it, split the body into named stages: move each independent 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 · docx._convert_body (cognitive 116) · ×1
  • docx._convert_body (cognitive 116) paddleocr/_doc2md/converters/docx.py:1288 — docx._convert_body has cognitive complexity 116 (threshold 15). Drivers by points: if/else 26 (86 pts), loops 7 (21 pts), boolean chains 8, error handling 1 (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.
D2 · Cognitive Complexity · PptxConverter._table_to_html (cognitive 115) · ×1
  • PptxConverter._table_to_html (cognitive 115) paddleocr/_doc2md/converters/pptx.py:459 — PptxConverter._table_to_html has cognitive complexity 115 (threshold 15). Drivers by points: if/else 17 (70 pts), loops 8 (27 pts), error handling 2 (10 pts), ternaries 2 (6 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · docx._table_to_html (cognitive 91) · ×1
  • docx._table_to_html (cognitive 91) paddleocr/_doc2md/converters/docx.py:832 — docx._table_to_html has cognitive complexity 91 (threshold 15). Drivers by points: if/else 12 (42 pts), loops 9 (29 pts), ternaries 3 (10 pts), boolean chains 6, error handling 1 (4 pts) (nesting depth added 60). To reduce it, split the body into named stages: move each independent 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 · CustomMBartDecoder.forward (cognitive 89) · ×1
  • CustomMBartDecoder.forward (cognitive 89) ppocr/modeling/heads/rec_unimernet_head.py:1663 — CustomMBartDecoder.forward has cognitive complexity 89 (threshold 15). Drivers by points: if/else 27 (44 pts), ternaries 20 (37 pts), boolean chains 6, loops 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · save_load.load_model (cognitive 89) · ×1
  • save_load.load_model (cognitive 89) REDACTED:66 — save_load.load_model has cognitive complexity 89 (threshold 15). Drivers by points: if/else 29 (80 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 56). 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 · RandomCrop.__call__ (cognitive 87) · ×1
  • RandomCrop.__call__ (cognitive 87) ppocr/data/imaug/random_crop_data.py:201 — RandomCrop.__call__ has cognitive complexity 87 (threshold 15). Drivers by points: if/else 25 (59 pts), ternaries 6 (16 pts), loops 4 (8 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 50). To reduce it, split the body into named stages: move each independent 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 · CustomMBartDecoder.forward (cognitive 85) · ×1
  • CustomMBartDecoder.forward (cognitive 85) ppocr/modeling/heads/rec_ppformulanet_head.py:412 — CustomMBartDecoder.forward has cognitive complexity 85 (threshold 15). Drivers by points: if/else 25 (40 pts), ternaries 20 (37 pts), boolean chains 6, loops 2 (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.
D2 · Cognitive Complexity · docx._iter_paragraph_items (cognitive 79) · ×1
  • docx._iter_paragraph_items (cognitive 79) paddleocr/_doc2md/converters/docx.py:358 — docx._iter_paragraph_items has cognitive complexity 79 (threshold 15). Drivers by points: if/else 21 (64 pts), error handling 4 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 48). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MBartDecoder.forward (cognitive 78) · ×1
  • MBartDecoder.forward (cognitive 78) ppocr/modeling/heads/rec_unimernet_head.py:1006 — MBartDecoder.forward has cognitive complexity 78 (threshold 15). Drivers by points: if/else 23 (38 pts), ternaries 18 (32 pts), boolean chains 6, loops 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.
D2 · Cognitive Complexity · TableMatch.get_pred_html (cognitive 69) · ×1
  • TableMatch.get_pred_html (cognitive 69) ppstructure/table/matcher.py:104 — TableMatch.get_pred_html has cognitive complexity 69 (threshold 15). Drivers by points: if/else 15 (62 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 50). 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 · trans_funsd_label.load_funsd_label (cognitive 65) · ×1
  • trans_funsd_label.load_funsd_label (cognitive 65) ppstructure/kie/tools/trans_funsd_label.py:39 — trans_funsd_label.load_funsd_label has cognitive complexity 65 (threshold 15). Drivers by points: if/else 11 (38 pts), loops 9 (25 pts), boolean chains 2 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · infer_rec.main (cognitive 65) · ×1
  • infer_rec.main (cognitive 65) tools/infer_rec.py:41 — infer_rec.main has cognitive complexity 65 (threshold 15). Drivers by points: if/else 26 (56 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 34). 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 · PptxConverter._chart_to_html (cognitive 64) · ×1
  • PptxConverter._chart_to_html (cognitive 64) paddleocr/_doc2md/converters/pptx.py:344 — PptxConverter._chart_to_html has cognitive complexity 64 (threshold 15). Drivers by points: ternaries 7 (18 pts), loops 8 (16 pts), if/else 10 (14 pts), error handling 6 (10 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.
D2 · Cognitive Complexity · TableMatch.get_pred_html_master (cognitive 64) · ×1
  • TableMatch.get_pred_html_master (cognitive 64) ppstructure/table/matcher.py:151 — TableMatch.get_pred_html_master has cognitive complexity 64 (threshold 15). Drivers by points: if/else 13 (57 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 47). 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 · train.main (cognitive 64) · ×1
  • train.main (cognitive 64) tools/train.py:46 — train.main has cognitive complexity 64 (threshold 15). Drivers by points: if/else 29 (58 pts), loops 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PptxConverter._process_shape (cognitive 62) · ×1
  • PptxConverter._process_shape (cognitive 62) paddleocr/_doc2md/converters/pptx.py:233 — PptxConverter._process_shape has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 5 (16 pts), error handling 3 (8 pts), boolean chains 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_end2end.e2e_eval (cognitive 59) · ×1
  • eval_end2end.e2e_eval (cognitive 59) tools/end2end/eval_end2end.py:70 — eval_end2end.e2e_eval has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (41 pts), loops 8 (16 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextDetector.__call__ (cognitive 58) · ×1
  • TextDetector.__call__ (cognitive 58) tools/infer/predict_det.py:310 — TextDetector.__call__ has cognitive complexity 58 (threshold 15). Drivers by points: if/else 18 (42 pts), ternaries 2 (8 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · save_load.update_train_results (cognitive 57) · ×1
  • save_load.update_train_results (cognitive 57) REDACTED:332 — save_load.update_train_results has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (26 pts), ternaries 4 (16 pts), loops 6 (12 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResNet.__init__ (cognitive 53) · ×1
  • ResNet.__init__ (cognitive 53) ppocr/modeling/backbones/det_resnet.py:128 — ResNet.__init__ has cognitive complexity 53 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 7 (19 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DetectionIoUEvaluator.evaluate_image (cognitive 52) · ×1
  • DetectionIoUEvaluator.evaluate_image (cognitive 52) ppocr/metrics/eval_det_iou.py:18 — DetectionIoUEvaluator.evaluate_image has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 7 (15 pts), ternaries 6 (11 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · export_model.export (cognitive 50) · ×1
  • export_model.export (cognitive 50) ppocr/utils/export_model.py:419 — export_model.export has cognitive complexity 50 (threshold 15). Drivers by points: if/else 24 (42 pts), loops 2 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval_with_label_end2end.eval_e2e (cognitive 49) · ×1
  • eval_with_label_end2end.eval_e2e (cognitive 49) ppstructure/kie/tools/eval_with_label_end2end.py:109 — eval_with_label_end2end.eval_e2e has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (35 pts), loops 6 (12 pts), boolean chains 2 (nesting depth added 32). 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 · DYMicroBlock.__init__ (cognitive 48) · ×1
  • DYMicroBlock.__init__ (cognitive 48) REDACTED:337 — DYMicroBlock.__init__ has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 20 (40 pts), boolean chains 6, if/else 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResNet.__init__ (cognitive 47) · ×1
  • ResNet.__init__ (cognitive 47) ppocr/modeling/backbones/rec_resnet_vd.py:192 — ResNet.__init__ has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 4 (10 pts), ternaries 3 (9 pts), boolean chains 4 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval.main (cognitive 46) · ×1
  • eval.main (cognitive 46) tools/eval.py:35 — eval.main has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (37 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResNet_SAST.__init__ (cognitive 45) · ×1
  • ResNet_SAST.__init__ (cognitive 45) ppocr/modeling/backbones/det_resnet_vd_sast.py:191 — ResNet_SAST.__init__ has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 5 (17 pts), if/else 7 (14 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VQATokenPad.__call__ (cognitive 42) · ×1
  • VQATokenPad.__call__ (cognitive 42) ppocr/data/imaug/vqa/token/vqa_token_pad.py:41 — VQATokenPad.__call__ has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docx._runs_to_markdown (cognitive 41) · ×1
  • docx._runs_to_markdown (cognitive 41) paddleocr/_doc2md/converters/docx.py:618 — docx._runs_to_markdown has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (28 pts), ternaries 2 (6 pts), boolean chains 5, loops 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WarpMLS.calc_delta (cognitive 41) · ×1
  • WarpMLS.calc_delta (cognitive 41) ppocr/data/imaug/text_image_aug/warp_mls.py:43 — WarpMLS.calc_delta has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 5 (14 pts), boolean chains 3 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResNet_vd.__init__ (cognitive 41) · ×1
  • ResNet_vd.__init__ (cognitive 41) ppocr/modeling/backbones/det_resnet_vd.py:262 — ResNet_vd.__init__ has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 7 (19 pts), loops 4 (10 pts), if/else 5 (9 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · predict_system.main (cognitive 41) · ×1
  • predict_system.main (cognitive 41) REDACTED:304 — predict_system.main has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 5, error handling 1 (3 pts), 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.
D2 · Cognitive Complexity · UniMERNetLabelEncode.__init__ (cognitive 39) · ×1
  • UniMERNetLabelEncode.__init__ (cognitive 39) REDACTED:1939 — UniMERNetLabelEncode.__init__ has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (6 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RandomCropImgMask.__call__ (cognitive 39) · ×1
  • RandomCropImgMask.__call__ (cognitive 39) ppocr/data/imaug/random_crop_data.py:533 — RandomCropImgMask.__call__ has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (28 pts), ternaries 4 (8 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · ResNetFPN.__init__ (cognitive 39) · ×1
  • ResNetFPN.__init__ (cognitive 39) ppocr/modeling/backbones/rec_resnet_fpn.py:28 — ResNetFPN.__init__ has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (11 pts), ternaries 2 (8 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UniMERNetDecode.__init__ (cognitive 39) · ×1
  • UniMERNetDecode.__init__ (cognitive 39) ppocr/postprocess/rec_postprocess.py:1292 — UniMERNetDecode.__init__ has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (6 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · predict_system.main (cognitive 39) · ×1
  • predict_system.main (cognitive 39) tools/infer/predict_system.py:185 — predict_system.main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 4 (8 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.
D2 · Cognitive Complexity · VLLabelDecode.__call__ (cognitive 36) · ×1
  • VLLabelDecode.__call__ (cognitive 36) ppocr/postprocess/rec_postprocess.py:1090 — VLLabelDecode.__call__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 5 (11 pts), boolean chains 3, ternaries 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 · quant.main (cognitive 35) · ×1
  • quant.main (cognitive 35) deploy/slim/quantization/quant.py:89 — quant.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 2 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docx._iter_math_paragraph_parts (cognitive 35) · ×1
  • docx._iter_math_paragraph_parts (cognitive 35) paddleocr/_doc2md/converters/docx.py:137 — docx._iter_math_paragraph_parts has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (16 pts), error handling 3 (9 pts), loops 3 (7 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VQATokenLabelEncode.__call__ (cognitive 35) · ×1
  • VQATokenLabelEncode.__call__ (cognitive 35) REDACTED:1100 — VQATokenLabelEncode.__call__ has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (32 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelOutput.__post_init__ (cognitive 35) · ×1
  • ModelOutput.__post_init__ (cognitive 35) ppocr/modeling/heads/rec_unimernet_head.py:55 — ModelOutput.__post_init__ has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 2 (5 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · export_model.main (cognitive 34) · ×1
  • export_model.main (cognitive 34) deploy/slim/quantization/export_model.py:40 — export_model.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docx._update_field_state_for_paragraph (cognitive 34) · ×1
  • docx._update_field_state_for_paragraph (cognitive 34) paddleocr/_doc2md/converters/docx.py:319 — docx._update_field_state_for_paragraph has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (30 pts), ternaries 1 (2 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · docx._textbox_paragraphs_to_markdown (cognitive 34) · ×1
  • docx._textbox_paragraphs_to_markdown (cognitive 34) paddleocr/_doc2md/converters/docx.py:1173 — docx._textbox_paragraphs_to_markdown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (6 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PptxConverter.convert_file (cognitive 34) · ×1
  • PptxConverter.convert_file (cognitive 34) paddleocr/_doc2md/converters/pptx.py:161 — PptxConverter.convert_file has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 6 (15 pts), error handling 2, boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PGProcessTrain.__call__ (cognitive 33) · ×1
  • PGProcessTrain.__call__ (cognitive 33) ppocr/data/imaug/pg_process.py:940 — PGProcessTrain.__call__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (26 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 6). 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 · GenTableMask.projection_cx (cognitive 33) · ×1
  • GenTableMask.projection_cx (cognitive 33) ppocr/data/imaug/table_ops.py:72 — GenTableMask.projection_cx has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RandomCropFlip.random_crop_flip (cognitive 32) · ×1
  • RandomCropFlip.random_crop_flip (cognitive 32) ppocr/data/imaug/fce_aug.py:86 — RandomCropFlip.random_crop_flip has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VQAReTokenMetric.re_score (cognitive 32) · ×1
  • VQAReTokenMetric.re_score (cognitive 32) ppocr/metrics/vqa_token_re_metric.py:79 — VQAReTokenMetric.re_score has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 3 (4 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 · utility.draw_structure_result (cognitive 32) · ×1
  • utility.draw_structure_result (cognitive 32) ppstructure/utility.py:159 — utility.draw_structure_result has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (9 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.
D2 · Cognitive Complexity · DistillationDMLLoss.forward (cognitive 31) · ×1
  • DistillationDMLLoss.forward (cognitive 31) ppocr/losses/distillation_loss.py:101 — DistillationDMLLoss.forward has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (13 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 4 other methods here (DistillationKLDivLoss.forward, DistillationDKDLoss.forward, DistillationKLDivLoss.forward, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · convert_ppocr_label.convert_label (cognitive 31) · ×1
  • convert_ppocr_label.convert_label (cognitive 31) tools/end2end/convert_ppocr_label.py:27 — convert_ppocr_label.convert_label has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (5 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Client.SaveResource (cognitive 31) · ×1
  • Client.SaveResource (cognitive 31) api_sdk/go/resource.go:44 — Client.SaveResource has cognitive complexity 31 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 1, loops 1 (nesting depth added 7). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · OcrPipelineRunner.predict (cognitive 31) · ×1
  • OcrPipelineRunner.predict (cognitive 31) paddleocr-js/packages/core/src/pipelines/ocr/core.ts:197 — OcrPipelineRunner.predict has cognitive complexity 31 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 4 (7 pts), boolean chains 4, ternaries 2 (4 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 · PGProcessTrain.generate_tcl_ctc_label (cognitive 30) · ×1
  • PGProcessTrain.generate_tcl_ctc_label (cognitive 30) ppocr/data/imaug/pg_process.py:450 — PGProcessTrain.generate_tcl_ctc_label has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 2 (4 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.
D2 · Cognitive Complexity · Adam.__call__ (cognitive 29) · ×1
  • Adam.__call__ (cognitive 29) ppocr/optimizer/optimizer.py:83 — Adam.__call__ has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (9 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.
D2 · Cognitive Complexity · SARLabelDecode.decode (cognitive 29) · ×1
  • SARLabelDecode.decode (cognitive 29) ppocr/postprocess/rec_postprocess.py:705 — SARLabelDecode.decode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SATRNLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SATRNLabelDecode.decode (cognitive 29) · ×1
  • SATRNLabelDecode.decode (cognitive 29) ppocr/postprocess/rec_postprocess.py:780 — SATRNLabelDecode.decode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SARLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · VQAReTokenChunk.__call__ (cognitive 28) · ×1
  • VQAReTokenChunk.__call__ (cognitive 28) ppocr/data/imaug/vqa/token/vqa_token_chunk.py:64 — VQAReTokenChunk.__call__ has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CTPostProcess.__call__ (cognitive 28) · ×1
  • CTPostProcess.__call__ (cognitive 28) ppocr/postprocess/ct_postprocess.py:47 — CTPostProcess.__call__ has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), error handling 1 (4 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.
D2 · Cognitive Complexity · locality_aware_nms.soft_nms (cognitive 28) · ×1
  • locality_aware_nms.soft_nms (cognitive 28) ppocr/postprocess/locality_aware_nms.py:106 — locality_aware_nms.soft_nms has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PicoDetPostProcess.__call__ (cognitive 28) · ×1
  • PicoDetPostProcess.__call__ (cognitive 28) ppocr/postprocess/picodet_postprocess.py:167 — PicoDetPostProcess.__call__ has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 5 (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.
D2 · Cognitive Complexity · export_model.dump_infer_config (cognitive 28) · ×1
  • export_model.dump_infer_config (cognitive 28) ppocr/utils/export_model.py:41 — export_model.dump_infer_config has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · program.eval (cognitive 28) · ×1
  • program.eval (cognitive 28) tools/program.py:709 — program.eval has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), boolean chains 2, ternaries 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 · export_model.dynamic_to_static (cognitive 27) · ×1
  • export_model.dynamic_to_static (cognitive 27) ppocr/utils/export_model.py:169 — export_model.dynamic_to_static has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · math.extract_math_from_paragraph (cognitive 26) · ×1
  • math.extract_math_from_paragraph (cognitive 26) paddleocr/_doc2md/math/__init__.py:37 — math.extract_math_from_paragraph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PaddleOCR._get_ocr_model_names (cognitive 26) · ×1
  • PaddleOCR._get_ocr_model_names (cognitive 26) paddleocr/_pipelines/ocr.py:318 — PaddleOCR._get_ocr_model_names has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (25 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 · save_load.save_model (cognitive 26) · ×1
  • save_load.save_model (cognitive 26) REDACTED:241 — save_load.save_model has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (23 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.
D2 · Cognitive Complexity · MakeShrinkMap.__call__ (cognitive 25) · ×1
  • MakeShrinkMap.__call__ (cognitive 25) ppocr/data/imaug/make_shrink_map.py:45 — MakeShrinkMap.__call__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TheseusLayer.init_net (cognitive 24) · ×1
  • TheseusLayer.init_net (cognitive 24) REDACTED:489 — TheseusLayer.init_net has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4 (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 · AttentionLayers.__init__ (cognitive 24) · ×1
  • AttentionLayers.__init__ (cognitive 24) ppocr/modeling/heads/rec_latexocr_head.py:483 — AttentionLayers.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 6 (8 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FCEFPN.__init__ (cognitive 24) · ×1
  • FCEFPN.__init__ (cognitive 24) ppocr/modeling/necks/fce_fpn.py:119 — FCEFPN.__init__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BaseRecLabelDecode.get_word_info (cognitive 24) · ×1
  • BaseRecLabelDecode.get_word_info (cognitive 24) ppocr/postprocess/rec_postprocess.py:72 — BaseRecLabelDecode.get_word_info has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 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 · CTCDecoder.decode (cognitive 24) · ×1
  • CTCDecoder.decode (cognitive 24) deploy/ppocr-android/ppocr-sdk/src/main/java/com/paddle/ocr/postprocess/CTCDecoder.kt:20 — CTCDecoder.decode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · det.decodeDetOutput (cognitive 24) · ×1
  • det.decodeDetOutput (cognitive 24) paddleocr-js/packages/core/src/models/det.ts:468 — det.decodeDetOutput has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 9). Of this number, 23 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 · pptx._format_run_segment (cognitive 23) · ×1
  • pptx._format_run_segment (cognitive 23) paddleocr/_doc2md/converters/pptx.py:111 — pptx._format_run_segment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CVRandomAffine.__init__ (cognitive 23) · ×1
  • CVRandomAffine.__init__ (cognitive 23) ppocr/data/imaug/abinet_aug.py:87 — CVRandomAffine.__init__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rec_pphgnetv2.set_identity (cognitive 23) · ×1
  • rec_pphgnetv2.set_identity (cognitive 23) REDACTED:734 — rec_pphgnetv2.set_identity has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PPFormulaNet_Head.generate_export (cognitive 23) · ×1
  • PPFormulaNet_Head.generate_export (cognitive 23) ppocr/modeling/heads/rec_ppformulanet_head.py:1057 — PPFormulaNet_Head.generate_export has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StructureSystem.__call__ (cognitive 23) · ×1
  • StructureSystem.__call__ (cognitive 23) REDACTED:98 — StructureSystem.__call__ has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (2 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 · infer_det.main (cognitive 23) · ×1
  • infer_det.main (cognitive 23) tools/infer_det.py:57 — infer_det.main has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · HttpClient.fetch (cognitive 23) · ×1
  • HttpClient.fetch (cognitive 23) api_sdk/typescript/src/internal/http.ts:178 — HttpClient.fetch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, error handling 2, ternaries 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 · config.normalizeOcrPipelineConfig (cognitive 23) · ×1
  • config.normalizeOcrPipelineConfig (cognitive 23) paddleocr-js/packages/core/src/pipelines/ocr/config.ts:133 — config.normalizeOcrPipelineConfig has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 10, boolean chains 8, if/else 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 · docx._extract_headers_footers (cognitive 22) · ×1
  • docx._extract_headers_footers (cognitive 22) paddleocr/_doc2md/converters/docx.py:1504 — docx._extract_headers_footers has cognitive complexity 22 (threshold 15). Drivers by points: error handling 6 (13 pts), if/else 4 (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 · xlsx._extract_drawing_math (cognitive 22) · ×1
  • xlsx._extract_drawing_math (cognitive 22) paddleocr/_doc2md/converters/xlsx.py:36 — xlsx._extract_drawing_math has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (7 pts), error handling 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.
D2 · Cognitive Complexity · PGProcessTrain.crop_area (cognitive 22) · ×1
  • PGProcessTrain.crop_area (cognitive 22) ppocr/data/imaug/pg_process.py:155 — PGProcessTrain.crop_area has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · random_crop_data.clip_poly_to_rect (cognitive 22) · ×1
  • random_crop_data.clip_poly_to_rect (cognitive 22) ppocr/data/imaug/random_crop_data.py:110 — random_crop_data.clip_poly_to_rect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (2 pts), boolean chains 1, error handling 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 · LaTeXOCRDataSet.__init__ (cognitive 22) · ×1
  • LaTeXOCRDataSet.__init__ (cognitive 22) ppocr/data/latexocr_dataset.py:63 — LaTeXOCRDataSet.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recovery_to_doc.convert_info_docx (cognitive 22) · ×1
  • recovery_to_doc.convert_info_docx (cognitive 22) ppstructure/recovery/recovery_to_doc.py:32 — recovery_to_doc.convert_info_docx has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utility.text_visual (cognitive 22) · ×1
  • utility.text_visual (cognitive 22) tools/infer/utility.py:774 — utility.text_visual has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OCREngine.run (cognitive 22) · ×1
  • OCREngine.run (cognitive 22) deploy/ppocr-android/ppocr-sdk/src/main/java/com/paddle/ocr/engine/OCREngine.kt:76 — OCREngine.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TableLabelEncode.__call__ (cognitive 21) · ×1
  • TableLabelEncode.__call__ (cognitive 21) REDACTED:700 — TableLabelEncode.__call__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleDataSet.get_ext_data (cognitive 21) · ×1
  • SimpleDataSet.get_ext_data (cognitive 21) REDACTED:350 — SimpleDataSet.get_ext_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (2 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bleu.compute_bleu (cognitive 21) · ×1
  • bleu.compute_bleu (cognitive 21) ppocr/metrics/bleu.py:46 — bleu.compute_bleu has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 5 (8 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 · PPFormulaNet_Head.generate (cognitive 21) · ×1
  • PPFormulaNet_Head.generate (cognitive 21) ppocr/modeling/heads/rec_ppformulanet_head.py:1183 — PPFormulaNet_Head.generate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 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 · GA_SPIN_Transformer.forward (cognitive 21) · ×1
  • GA_SPIN_Transformer.forward (cognitive 21) ppocr/modeling/transforms/gaspin_transformer.py:248 — GA_SPIN_Transformer.forward has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (21 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 · AttnLabelDecode.decode (cognitive 21) · ×1
  • AttnLabelDecode.decode (cognitive 21) ppocr/postprocess/rec_postprocess.py:285 — AttnLabelDecode.decode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (RFLLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · RFLLabelDecode.decode (cognitive 21) · ×1
  • RFLLabelDecode.decode (cognitive 21) ppocr/postprocess/rec_postprocess.py:363 — RFLLabelDecode.decode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AttnLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · network._download (cognitive 21) · ×1
  • network._download (cognitive 21) ppocr/utils/network.py:49 — network._download has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (7 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utility.get_image_file_list (cognitive 21) · ×1
  • utility.get_image_file_list (cognitive 21) ppocr/utils/utility.py:67 — utility.get_image_file_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · APP_Image2Doc.downloadModels (cognitive 21) · ×1
  • APP_Image2Doc.downloadModels (cognitive 21) ppstructure/pdf2word/pdf2word.py:334 — APP_Image2Doc.downloadModels has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), error handling 2 (5 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 · TextSystem.__call__ (cognitive 21) · ×1
  • TextSystem.__call__ (cognitive 21) tools/infer/predict_system.py:76 — TextSystem.__call__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cli._execute_api (cognitive 20) · ×1
  • cli._execute_api (cognitive 20) paddleocr/_api_client/cli.py:208 — cli._execute_api has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2, error handling 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · DetResizeForTest.resize_image_type0 (cognitive 20) · ×1
  • DetResizeForTest.resize_image_type0 (cognitive 20) REDACTED:270 — DetResizeForTest.resize_image_type0 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · random_crop_data.crop_area (cognitive 20) · ×1
  • random_crop_data.crop_area (cognitive 20) ppocr/data/imaug/random_crop_data.py:416 — random_crop_data.crop_area has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MultiScaleSampler.iter (cognitive 20) · ×1
  • MultiScaleSampler.iter (cognitive 20) ppocr/data/multi_scale_sampler.py:123 — MultiScaleSampler.iter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 1 (4 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 · DonutSwinEncoder.forward (cognitive 20) · ×1
  • DonutSwinEncoder.forward (cognitive 20) ppocr/modeling/backbones/rec_donut_swin.py:980 — DonutSwinEncoder.forward has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (5 pts), boolean chains 3, 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 · ModelEMA.__init__ (cognitive 20) · ×1
  • ModelEMA.__init__ (cognitive 20) ppocr/utils/ema.py:41 — ModelEMA.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (5 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StructureSystem.__init__ (cognitive 20) · ×1
  • StructureSystem.__init__ (cognitive 20) REDACTED:45 — StructureSystem.__init__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 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 · tablepyxl.write_rows (cognitive 20) · ×1
  • tablepyxl.write_rows (cognitive 20) ppstructure/table/tablepyxl/tablepyxl.py:26 — tablepyxl.write_rows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (6 pts), boolean chains 4 (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 · program.check_device (cognitive 20) · ×1
  • program.check_device (cognitive 20) tools/program.py:118 — program.check_device has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shared.readExplicitPipelineRuntimeDefaults (cognitive 20) · ×1
  • shared.readExplicitPipelineRuntimeDefaults (cognitive 20) paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:210 — shared.readExplicitPipelineRuntimeDefaults has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 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 · draw-text.drawTextPanel (cognitive 20) · ×1
  • draw-text.drawTextPanel (cognitive 20) paddleocr-js/packages/core/src/viz/ocr/draw-text.ts:74 — draw-text.drawTextPanel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, 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 · docx._extract_textbox_paragraphs (cognitive 19) · ×1
  • docx._extract_textbox_paragraphs (cognitive 19) paddleocr/_doc2md/converters/docx.py:1139 — docx._extract_textbox_paragraphs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 1, error handling 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 · GroupRandomCropPadding.__call__ (cognitive 19) · ×1
  • GroupRandomCropPadding.__call__ (cognitive 19) ppocr/data/imaug/ct_process.py:213 — GroupRandomCropPadding.__call__ has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 5 (6 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AugmenterBuilder.map_arguments (cognitive 19) · ×1
  • AugmenterBuilder.map_arguments (cognitive 19) ppocr/data/imaug/iaa_augment.py:133 — AugmenterBuilder.map_arguments has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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 · MultiScaleSampler.__init__ (cognitive 19) · ×1
  • MultiScaleSampler.__init__ (cognitive 19) ppocr/data/multi_scale_sampler.py:10 — MultiScaleSampler.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (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.
D2 · Cognitive Complexity · Attention.forward (cognitive 19) · ×1
  • Attention.forward (cognitive 19) ppocr/modeling/heads/rec_latexocr_head.py:332 — Attention.forward has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 1 (2 pts), boolean chains 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 · FCEFPN.forward (cognitive 19) · ×1
  • FCEFPN.forward (cognitive 19) ppocr/modeling/necks/fce_fpn.py:260 — FCEFPN.forward has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SASTPostProcess.detect_sast (cognitive 19) · ×1
  • SASTPostProcess.detect_sast (cognitive 19) ppocr/postprocess/sast_postprocess.py:201 — SASTPostProcess.detect_sast has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Client.pollUntilDone (cognitive 19) · ×1
  • Client.pollUntilDone (cognitive 19) api_sdk/go/poller.go:29 — Client.pollUntilDone has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paddleocr.parseDocParsingResult (cognitive 19) · ×1
  • paddleocr.parseDocParsingResult (cognitive 19) api_sdk/go/ocr.go:209 — paddleocr.parseDocParsingResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · docx._detect_heading_level (cognitive 18) · ×1
  • docx._detect_heading_level (cognitive 18) paddleocr/_doc2md/converters/docx.py:260 — docx._detect_heading_level has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 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.
D2 · Cognitive Complexity · PPStructureV3._get_ocr_model_names (cognitive 18) · ×1
  • PPStructureV3._get_ocr_model_names (cognitive 18) paddleocr/_pipelines/pp_structurev3.py:530 — PPStructureV3._get_ocr_model_names has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GenTableMask.projection (cognitive 18) · ×1
  • GenTableMask.projection (cognitive 18) ppocr/data/imaug/table_ops.py:35 — GenTableMask.projection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (7 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.
D2 · Cognitive Complexity · BaseModel.forward (cognitive 18) · ×1
  • BaseModel.forward (cognitive 18) ppocr/modeling/architectures/base_model.py:80 — BaseModel.forward has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · rec_hybridvit._init_vit_weights (cognitive 18) · ×1
  • rec_hybridvit._init_vit_weights (cognitive 18) ppocr/modeling/backbones/rec_hybridvit.py:495 — rec_hybridvit._init_vit_weights has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). 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 · AttentionLayers.forward (cognitive 18) · ×1
  • AttentionLayers.forward (cognitive 18) ppocr/modeling/heads/rec_latexocr_head.py:601 — AttentionLayers.forward has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1, ternaries 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 · SEEDLabelDecode.decode (cognitive 18) · ×1
  • SEEDLabelDecode.decode (cognitive 18) ppocr/postprocess/rec_postprocess.py:463 — SEEDLabelDecode.decode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SRNLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SRNLabelDecode.decode (cognitive 18) · ×1
  • SRNLabelDecode.decode (cognitive 18) ppocr/postprocess/rec_postprocess.py:544 — SRNLabelDecode.decode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SEEDLabelDecode.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · HtmlToDocx.handle_data (cognitive 18) · ×1
  • HtmlToDocx.handle_data (cognitive 18) ppstructure/recovery/table_process.py:289 — HtmlToDocx.handle_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextDetector.__init__ (cognitive 18) · ×1
  • TextDetector.__init__ (cognitive 18) tools/infer/predict_det.py:37 — TextDetector.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 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.
D2 · Cognitive Complexity · paddleocr.parseOCRResult (cognitive 18) · ×1
  • paddleocr.parseOCRResult (cognitive 18) api_sdk/go/ocr.go:172 — paddleocr.parseOCRResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 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 · generate_multi_language_configs.merge_config (cognitive 17) · ×1
  • generate_multi_language_configs.merge_config (cognitive 17) configs/rec/multi_language/generate_multi_language_configs.py:221 — generate_multi_language_configs.merge_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · xlsx._find_data_bounds (cognitive 17) · ×1
  • xlsx._find_data_bounds (cognitive 17) paddleocr/_doc2md/converters/xlsx.py:112 — xlsx._find_data_bounds has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UniMERNetLabelEncode.set_truncation_and_padding (cognitive 17) · ×1
  • UniMERNetLabelEncode.set_truncation_and_padding (cognitive 17) REDACTED:2069 — UniMERNetLabelEncode.set_truncation_and_padding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DistillationVQADistanceLoss.forward (cognitive 17) · ×1
  • DistillationVQADistanceLoss.forward (cognitive 17) ppocr/losses/distillation_loss.py:947 — DistillationVQADistanceLoss.forward has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 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.
D2 · Cognitive Complexity · TheseusLayer.upgrade_sublayer (cognitive 17) · ×1
  • TheseusLayer.upgrade_sublayer (cognitive 17) REDACTED:564 — TheseusLayer.upgrade_sublayer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (5 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 · rec_pphgnetv2.parse_pattern_str (cognitive 17) · ×1
  • rec_pphgnetv2.parse_pattern_str (cognitive 17) REDACTED:772 — rec_pphgnetv2.parse_pattern_str has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalGraphs.generate_local_graphs (cognitive 17) · ×1
  • LocalGraphs.generate_local_graphs (cognitive 17) ppocr/modeling/heads/local_graph.py:161 — LocalGraphs.generate_local_graphs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (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 · PPFormulaNet_Head._prepare_decoder_input_ids_for_generation (cognitive 17) · ×1
  • PPFormulaNet_Head._prepare_decoder_input_ids_for_generation (cognitive 17) ppocr/modeling/heads/rec_ppformulanet_head.py:968 — PPFormulaNet_Head._prepare_decoder_input_ids_for_generation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HtmlToDocx.handle_table (cognitive 17) · ×1
  • HtmlToDocx.handle_table (cognitive 17) ppstructure/recovery/table_process.py:239 — HtmlToDocx.handle_table has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextRecognizer.resize_norm_img (cognitive 17) · ×1
  • TextRecognizer.resize_norm_img (cognitive 17) tools/infer/predict_rec.py:208 — TextRecognizer.resize_norm_img has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · program.merge_config (cognitive 17) · ×1
  • program.merge_config (cognitive 17) tools/program.py:88 — program.merge_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · program.preprocess (cognitive 17) · ×1
  • program.preprocess (cognitive 17) tools/program.py:873 — program.preprocess has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DRRGTargets.find_head_tail (cognitive 16) · ×1
  • DRRGTargets.find_head_tail (cognitive 16) ppocr/data/imaug/drrg_targets.py:82 — DRRGTargets.find_head_tail has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EASTProcessTrain.crop_area (cognitive 16) · ×1
  • EASTProcessTrain.crop_area (cognitive 16) ppocr/data/imaug/east_process.py:291 — EASTProcessTrain.crop_area has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FCENetTargets.find_head_tail (cognitive 16) · ×1
  • FCENetTargets.find_head_tail (cognitive 16) ppocr/data/imaug/fce_targets.py:170 — FCENetTargets.find_head_tail has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AugmenterBuilder.build (cognitive 16) · ×1
  • AugmenterBuilder.build (cognitive 16) ppocr/data/imaug/iaa_augment.py:78 — AugmenterBuilder.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LatexOCRLabelEncode._convert_encoding (cognitive 16) · ×1
  • LatexOCRLabelEncode._convert_encoding (cognitive 16) REDACTED:1800 — LatexOCRLabelEncode._convert_encoding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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. This shape REPEATS in the file: one other method here (UniMERNetLabelEncode._convert_encoding) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UniMERNetLabelEncode._convert_encoding (cognitive 16) · ×1
  • UniMERNetLabelEncode._convert_encoding (cognitive 16) REDACTED:2116 — UniMERNetLabelEncode._convert_encoding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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. This shape REPEATS in the file: one other method here (LatexOCRLabelEncode._convert_encoding) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SASTProcessTrain.crop_area (cognitive 16) · ×1
  • SASTProcessTrain.crop_area (cognitive 16) ppocr/data/imaug/sast_process.py:134 — SASTProcessTrain.crop_area has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SASTProcessTrain.__call__ (cognitive 16) · ×1
  • SASTProcessTrain.__call__ (cognitive 16) ppocr/data/imaug/sast_process.py:681 — SASTProcessTrain.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · GenTableMask.__call__ (cognitive 16) · ×1
  • GenTableMask.__call__ (cognitive 16) ppocr/data/imaug/table_ops.py:159 — GenTableMask.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (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.
D2 · Cognitive Complexity · GoTImgDecode._compute_resized_output_size (cognitive 16) · ×1
  • GoTImgDecode._compute_resized_output_size (cognitive 16) ppocr/data/imaug/unimernet_aug.py:516 — GoTImgDecode._compute_resized_output_size has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (UniMERNetImgDecode._compute_resized_output_size, UniMERNetResize._compute_resized_output_size) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UniMERNetImgDecode._compute_resized_output_size (cognitive 16) · ×1
  • UniMERNetImgDecode._compute_resized_output_size (cognitive 16) ppocr/data/imaug/unimernet_aug.py:623 — UniMERNetImgDecode._compute_resized_output_size has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (GoTImgDecode._compute_resized_output_size, UniMERNetResize._compute_resized_output_size) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · UniMERNetResize._compute_resized_output_size (cognitive 16) · ×1
  • UniMERNetResize._compute_resized_output_size (cognitive 16) ppocr/data/imaug/unimernet_aug.py:755 — UniMERNetResize._compute_resized_output_size has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (GoTImgDecode._compute_resized_output_size, UniMERNetImgDecode._compute_resized_output_size) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · DiverseBranchBlock.__init__ (cognitive 16) · ×1
  • DiverseBranchBlock.__init__ (cognitive 16) REDACTED:218 — DiverseBranchBlock.__init__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParseQHead.forward_test (cognitive 16) · ×1
  • ParseQHead.forward_test (cognitive 16) ppocr/modeling/heads/rec_parseq_head.py:315 — ParseQHead.forward_test has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 1, ternaries 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 · PRENLabelDecode.decode (cognitive 16) · ×1
  • PRENLabelDecode.decode (cognitive 16) ppocr/postprocess/rec_postprocess.py:889 — PRENLabelDecode.decode 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.
D2 · Cognitive Complexity · save_load.load_pretrained_params (cognitive 16) · ×1
  • save_load.load_pretrained_params (cognitive 16) REDACTED:199 — save_load.load_pretrained_params has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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 · table_master_match.sort_bbox (cognitive 16) · ×1
  • table_master_match.sort_bbox (cognitive 16) REDACTED:229 — table_master_match.sort_bbox has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextDetector.predict (cognitive 16) · ×1
  • TextDetector.predict (cognitive 16) tools/infer/predict_det.py:244 — TextDetector.predict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 2 (4 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 · DBPostProcessor.process (cognitive 16) · ×1
  • DBPostProcessor.process (cognitive 16) deploy/ppocr-android/ppocr-sdk/src/main/java/com/paddle/ocr/postprocess/DBPostProcessor.kt:33 — DBPostProcessor.process has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D35 · Change Coupling · Change coupling clique · ×1
  • Change coupling clique: REDACTED, REDACTED, REDACTED, REDACTED, program.py REDACTED — 5 files — `REDACTED`, `REDACTED`, `REDACTED`, `REDACTED`, `tools/program.py` — all change together with no explicit dependency: a fully-connected co-change clique, not 10 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
D35 · Change Coupling · Change coupling · ×1
  • Change coupling: recovery_to_doc.py ↔ utility.py ppstructure/recovery/recovery_to_doc.py:1 — `ppstructure/recovery/recovery_to_doc.py` and `ppstructure/utility.py` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — 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 6 shared commits counted here, the most recent 3 are `269e5b8f` 1.在ppstructure管道中添加latex_ocr公式识别功能;2.添加pdf转markdown文件功能 (#13868); `681467d4` [bug fix] fix none res in recovery (#10603); `03d88168` update code_doc (#7667) — run `git show` on any of them.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (7 members, 47 shared lines) · ×1
  • Near-duplicate member family (7 members, 47 shared lines) paddleocr/_pipelines/ocr.py:431 — paddleocr/_pipelines/ocr.py:431-588 | paddleocr/_pipelines/paddleocr_vl.py:306-497 | paddleocr/_pipelines/pp_chatocrv4_doc.py:430-682 | paddleocr/_pipelines/pp_doctranslation.py:568-908 | paddleocr/_pipelines/pp_structurev3.py:699-1025 | paddleocr/_pipelines/seal_recognition.py:251-372 | paddleocr/_pipelines/table_recognition_v2.py:275-434 — These 7 members are variants of one another: a block of 47 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 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 · Near-duplicate member family (5 members, 38 shared lines) · ×1
  • Near-duplicate member family (5 members, 38 shared lines) ppocr/losses/distillation_loss.py:102 — ppocr/losses/distillation_loss.py:102-140 | ppocr/losses/distillation_loss.py:198-245 | ppocr/losses/distillation_loss.py:306-356 | ppocr/losses/distillation_loss.py:452-499 | ppocr/losses/distillation_loss.py:560-610 — These 5 members are variants of one another: a block of 38 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 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 · Near-duplicate member family (5 members, 17 shared lines) · ×1
  • Near-duplicate member family (5 members, 17 shared lines) ppocr/losses/distillation_loss.py:198 — ppocr/losses/distillation_loss.py:198-245 | ppocr/losses/distillation_loss.py:306-356 | ppocr/losses/distillation_loss.py:363-394 | ppocr/losses/distillation_loss.py:452-499 | ppocr/losses/distillation_loss.py:560-610 — These 5 members are variants of one another: a block of 17 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 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 · Near-duplicate member family (5 members, 11 shared lines) · ×1
  • Near-duplicate member family (5 members, 11 shared lines) ppocr/modeling/necks/db_fpn.py:188 — ppocr/modeling/necks/db_fpn.py:188-218 | ppocr/modeling/necks/db_fpn.py:271-304 | ppocr/modeling/necks/db_fpn.py:386-421 | ppocr/modeling/necks/db_fpn.py:509-551 | ppocr/modeling/necks/db_fpn.py:898-942 — These 5 members are variants of one another: a block of 11 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 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 · Near-duplicate member family (4 members, 64 shared lines) · ×1
  • Near-duplicate member family (4 members, 64 shared lines) paddleocr/_pipelines/formula_recognition.py:185 — paddleocr/_pipelines/formula_recognition.py:185-281 | paddleocr/_pipelines/pp_chatocrv4_doc.py:430-682 | paddleocr/_pipelines/pp_doctranslation.py:568-908 | paddleocr/_pipelines/pp_structurev3.py:699-1025 — These 4 members are variants of one another: a block of 64 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 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 · Near-duplicate member family (4 members, 54 shared lines) · ×1
  • Near-duplicate member family (4 members, 54 shared lines) paddleocr/_pipelines/formula_recognition.py:185 — paddleocr/_pipelines/formula_recognition.py:185-281 | paddleocr/_pipelines/paddleocr_vl.py:306-497 | paddleocr/_pipelines/pp_doctranslation.py:568-908 | paddleocr/_pipelines/pp_structurev3.py:699-1025 — These 4 members are variants of one another: a block of 54 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 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 · Near-duplicate member family (4 members, 22 shared lines) · ×1
  • Near-duplicate member family (4 members, 22 shared lines) ppocr/postprocess/sast_postprocess.py:79 — ppocr/postprocess/sast_postprocess.py:79-107 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:336-364 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:72-100 | ppocr/utils/e2e_utils/visual.py:129-157 — These 4 members are variants of one another: a block of 22 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 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 · Near-duplicate member family (4 members, 16 shared lines) · ×1
  • Near-duplicate member family (4 members, 16 shared lines) ppocr/data/imaug/pg_process.py:82 — ppocr/data/imaug/pg_process.py:82-107 | ppocr/data/imaug/pg_process.py:668-699 | ppocr/data/imaug/sast_process.py:59-86 | ppocr/data/imaug/sast_process.py:453-484 — These 4 members are variants of one another: a block of 16 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 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 · Near-duplicate member family (4 members, 15 shared lines) · ×1
  • Near-duplicate member family (4 members, 15 shared lines) deploy/avh/convert_image.py:29 — deploy/avh/convert_image.py:29-52 | REDACTED:632-656 | tools/infer/predict_cls.py:68-87 | tools/infer/predict_rec.py:433-457 — These 4 members are variants of one another: a block of 15 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 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 · Near-duplicate member family (3 members, 147 shared lines) · ×1
  • Near-duplicate member family (3 members, 147 shared lines) ppocr/modeling/heads/rec_ppformulanet_head.py:427 — ppocr/modeling/heads/rec_ppformulanet_head.py:427-635 | ppocr/modeling/heads/rec_unimernet_head.py:1022-1199 | ppocr/modeling/heads/rec_unimernet_head.py:1679-1880 — These 3 members are variants of one another: a block of 147 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 3 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 3 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 40 shared lines) · ×1
  • Near-duplicate member family (3 members, 40 shared lines) ppocr/modeling/backbones/det_resnet_vd.py:265 — ppocr/modeling/backbones/det_resnet_vd.py:265-357 | ppocr/modeling/backbones/det_resnet_vd_sast.py:192-302 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:190-282 — These 3 members are variants of one another: a block of 40 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 3 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 3 times.
D4 · Code Duplication · Near-duplicate member pair (89 shared lines) · ×1
  • Near-duplicate member pair (89 shared lines) ppocr/data/imaug/drrg_targets.py:83 — ppocr/data/imaug/drrg_targets.py:83-175 | ppocr/data/imaug/fce_targets.py:171-276 — These two members are variants of one another: 89 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 (67 shared lines) · ×1
  • Near-duplicate member pair (67 shared lines) ppocr/data/imaug/pg_process.py:941 — ppocr/data/imaug/pg_process.py:941-1116 | ppocr/data/imaug/sast_process.py:682-810 — These two members are variants of one another: 67 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) ppocr/data/imaug/pg_process.py:461 — ppocr/data/imaug/pg_process.py:461-638 | ppocr/data/imaug/sast_process.py:259-335 — 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 · Edited copy of a member (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) deploy/slim/quantization/export_model.py:44 — deploy/slim/quantization/export_model.py:44-184 | deploy/slim/quantization/quant.py:91-221 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) ppocr/data/imaug/pg_process.py:641 — ppocr/data/imaug/pg_process.py:641-665 | ppocr/data/imaug/sast_process.py:426-450 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) ppocr/modeling/heads/rec_att_head.py:42 — ppocr/modeling/heads/rec_att_head.py:42-84 | ppocr/modeling/heads/rec_spin_att_head.py:46-91 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) ppocr/data/imaug/pg_process.py:315 — ppocr/data/imaug/pg_process.py:315-403 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:95-131 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×1
  • Edited copy of a member (21 corresponding lines) ppocr/modeling/necks/fpn.py:27 — ppocr/modeling/necks/fpn.py:27-59 | ppocr/modeling/necks/fpn.py:67-120 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×1
  • Edited copy of a member (14 corresponding lines) ppocr/postprocess/rec_postprocess.py:1237 — ppocr/postprocess/rec_postprocess.py:1237-1250 | ppocr/postprocess/rec_postprocess.py:1521-1534 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) ppocr/postprocess/db_postprocess.py:169 — ppocr/postprocess/db_postprocess.py:169-187 | tools/infer/utility.py:913-932 — 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 (12 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (12 members, 50+ identical tokens) paddleocr/_pipelines/paddleocr_vl.py:129 — paddleocr/_pipelines/paddleocr_vl.py:129-155 | paddleocr/_pipelines/paddleocr_vl.py:186-214 | paddleocr/_pipelines/pp_chatocrv4_doc.py:131-155 | paddleocr/_pipelines/pp_chatocrv4_doc.py:184-210 | paddleocr/_pipelines/pp_doctranslation.py:140-173 | paddleocr/_pipelines/pp_doctranslation.py:211-246 | paddleocr/_pipelines/pp_structurev3.py:186-221 | paddleocr/_pipelines/pp_structurev3.py:261-298 | paddleocr/_pipelines/seal_recognition.py:107-124 | paddleocr/_pipelines/seal_recognition.py:146-165 | paddleocr/_pipelines/table_recognition_v2.py:96-117 | paddleocr/_pipelines/table_recognition_v2.py:143-166 — These 12 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 12 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 12 times.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) ppocr/modeling/heads/det_east_head.py:39 — ppocr/modeling/heads/det_east_head.py:39-60 | ppocr/modeling/heads/det_sast_head.py:38-59 | ppocr/modeling/heads/e2e_pg_head.py:39-61 | ppocr/modeling/necks/east_fpn.py:38-59 | ppocr/modeling/necks/east_fpn.py:80-100 | ppocr/modeling/necks/pg_fpn.py:86-108 | ppocr/modeling/necks/sast_fpn.py:37-58 | ppocr/modeling/necks/sast_fpn.py:78-98 — These 8 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 8 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 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) REDACTED:590 — REDACTED:590-596 | ppocr/modeling/backbones/rec_svtrv2.py:563-569 | REDACTED:252-258 | REDACTED:293-299 | REDACTED:110-116 | REDACTED:287-293 | ppocr/modeling/necks/rnn.py:208-214 — 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 (64–65 lines × 2) · ×1
  • Duplicated block (64–65 lines × 2) ppocr/modeling/backbones/det_resnet_vd_sast.py:239 — ppocr/modeling/backbones/det_resnet_vd_sast.py:239-302 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:218-282 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet_vd_sast.py:239` 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 (62–63 lines × 2) · ×1
  • Duplicated block (62–63 lines × 2) REDACTED:1966 — REDACTED:1966-2028 | ppocr/postprocess/rec_postprocess.py:1321-1382 — 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 (49–50 lines × 2) · ×1
  • Duplicated block (49–50 lines × 2) paddleocr/_pipelines/pp_chatocrv4_doc.py:572 — paddleocr/_pipelines/pp_chatocrv4_doc.py:572-621 | paddleocr/_pipelines/seal_recognition.py:306-354 — before extracting anything, compare `paddleocr/_pipelines/pp_chatocrv4_doc.py` and `paddleocr/_pipelines/seal_recognition.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 281 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/pp_chatocrv4_doc.py:572` 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 (46–49 lines × 2) · ×1
  • Duplicated block (46–49 lines × 2) ppocr/modeling/backbones/det_mobilenet_v3.py:50 — ppocr/modeling/backbones/det_mobilenet_v3.py:50-95 | ppocr/modeling/backbones/rec_mobilenet_v3.py:57-105 — 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 (49 lines × 2) · ×1
  • Duplicated block (49 lines × 2) ppocr/modeling/necks/db_fpn.py:134 — ppocr/modeling/necks/db_fpn.py:134-182 | ppocr/modeling/necks/table_fpn.py:42-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:134` 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 (45–48 lines × 3) · ×1
  • Duplicated block (45–48 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:429 — ppocr/modeling/heads/rec_ppformulanet_head.py:429-476 | ppocr/modeling/heads/rec_unimernet_head.py:1022-1066 | ppocr/modeling/heads/rec_unimernet_head.py:1680-1724 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 (47–48 lines × 3) · ×1
  • Duplicated block (47–48 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:544 — ppocr/modeling/heads/rec_ppformulanet_head.py:544-590 | ppocr/modeling/heads/rec_unimernet_head.py:1117-1164 | ppocr/modeling/heads/rec_unimernet_head.py:1791-1838 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:544` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (48 lines × 2) · ×1
  • Duplicated block (48 lines × 2) ppocr/data/imaug/pg_process.py:715 — ppocr/data/imaug/pg_process.py:715-762 | ppocr/data/imaug/sast_process.py:500-547 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 (47 lines × 2) · ×1
  • Duplicated block (47 lines × 2) deploy/slim/quantization/export_model.py:79 — deploy/slim/quantization/export_model.py:79-125 | deploy/slim/quantization/quant.py:113-159 — before extracting anything, compare `deploy/slim/quantization/export_model.py` and `deploy/slim/quantization/quant.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `deploy/slim/quantization/export_model.py:79` 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 (30–46 lines × 5) · ×1
  • Duplicated block (30–46 lines × 5) paddleocr/_pipelines/pp_doctranslation.py:695 — paddleocr/_pipelines/pp_doctranslation.py:695-739 | paddleocr/_pipelines/pp_doctranslation.py:817-862 | paddleocr/_pipelines/pp_structurev3.py:808-852 | paddleocr/_pipelines/pp_structurev3.py:930-975 | paddleocr/_pipelines/table_recognition_v2.py:387-416 — before extracting anything, compare `paddleocr/_pipelines/pp_doctranslation.py` and `paddleocr/_pipelines/pp_structurev3.py` as WHOLE FILES: this scan already matched 18 separate duplicated blocks between them, totalling at least 459 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/pp_doctranslation.py:695` 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 (40–44 lines × 2) · ×1
  • Duplicated block (40–44 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:1011 — ppocr/modeling/heads/rec_ppformulanet_head.py:1011-1054 | ppocr/modeling/heads/rec_unimernet_head.py:2186-2225 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:1011` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (38–40 lines × 2) · ×1
  • Duplicated block (38–40 lines × 2) ppocr/modeling/heads/local_graph.py:162 — ppocr/modeling/heads/local_graph.py:162-199 | ppocr/modeling/heads/proposal_local_graph.py:282-321 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (35–36 lines × 2) · ×1
  • Duplicated block (35–36 lines × 2) ppocr/utils/logging.py:30 — ppocr/utils/logging.py:30-65 | REDACTED:43-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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 (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) ppocr/data/imaug/drrg_targets.py:111 — ppocr/data/imaug/drrg_targets.py:111-145 | ppocr/data/imaug/fce_targets.py:212-246 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/drrg_targets.py:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (32–35 lines × 2) · ×1
  • Duplicated block (32–35 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:855 — ppocr/modeling/heads/rec_ppformulanet_head.py:855-889 | ppocr/modeling/heads/rec_unimernet_head.py:2317-2348 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:855` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30–33 lines × 2) · ×1
  • Duplicated block (30–33 lines × 2) ppocr/modeling/backbones/det_resnet_vd_sast.py:196 — ppocr/modeling/backbones/det_resnet_vd_sast.py:196-228 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:194-223 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 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 (29–31 lines × 6) · ×1
  • Duplicated block (29–31 lines × 6) paddleocr/_pipelines/formula_recognition.py:200 — paddleocr/_pipelines/formula_recognition.py:200-228 | paddleocr/_pipelines/ocr.py:476-504 | paddleocr/_pipelines/pp_chatocrv4_doc.py:547-575 | paddleocr/_pipelines/pp_doctranslation.py:842-872 | paddleocr/_pipelines/pp_structurev3.py:955-985 | paddleocr/_pipelines/seal_recognition.py:291-319 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/formula_recognition.py:200` 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 (27–30 lines × 6) · ×1
  • Duplicated block (27–30 lines × 6) paddleocr/_pipelines/pp_chatocrv4_doc.py:653 — paddleocr/_pipelines/pp_chatocrv4_doc.py:653-682 | paddleocr/_pipelines/pp_doctranslation.py:685-711 | paddleocr/_pipelines/pp_doctranslation.py:807-833 | paddleocr/_pipelines/pp_structurev3.py:798-824 | paddleocr/_pipelines/pp_structurev3.py:920-946 | paddleocr/_pipelines/table_recognition_v2.py:377-403 — before extracting anything, compare `paddleocr/_pipelines/pp_chatocrv4_doc.py` and `paddleocr/_pipelines/pp_doctranslation.py` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 372 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/pp_chatocrv4_doc.py:653` 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 (29–30 lines × 5) · ×1
  • Duplicated block (29–30 lines × 5) ppocr/losses/distillation_loss.py:112 — ppocr/losses/distillation_loss.py:112-140 | ppocr/losses/distillation_loss.py:216-245 | ppocr/losses/distillation_loss.py:327-356 | ppocr/losses/distillation_loss.py:470-499 | ppocr/losses/distillation_loss.py:581-610 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/losses/distillation_loss.py:112` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (15–30 lines × 2) · ×1
  • Duplicated block (15–30 lines × 2) ppocr/utils/export_model.py:200 — ppocr/utils/export_model.py:200-214 | ppocr/utils/export_model.py:243-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) tools/eval.py:42 — tools/eval.py:42-71 | tools/infer_rec.py:53-81 — before extracting anything, compare `tools/eval.py` and `tools/infer_rec.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/infer_rec.py:82` calls `getattr` and `tools/eval.py:72` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (27–29 lines × 4) · ×1
  • Duplicated block (27–29 lines × 4) paddleocr/_pipelines/formula_recognition.py:226 — paddleocr/_pipelines/formula_recognition.py:226-253 | paddleocr/_pipelines/paddleocr_vl.py:313-341 | paddleocr/_pipelines/pp_doctranslation.py:586-614 | paddleocr/_pipelines/pp_structurev3.py:701-727 — before extracting anything, compare `paddleocr/_pipelines/formula_recognition.py` and `paddleocr/_pipelines/paddleocr_vl.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/formula_recognition.py:226` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28–29 lines × 2) · ×1
  • Duplicated block (28–29 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:660 — ppocr/modeling/heads/rec_ppformulanet_head.py:660-688 | ppocr/modeling/heads/rec_unimernet_head.py:826-853 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25–28 lines × 2) · ×1
  • Duplicated block (25–28 lines × 2) tools/infer/predict_det.py:326 — tools/infer/predict_det.py:326-353 | tools/infer/predict_det.py:374-398 — both copies are in the same file, so extract the 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 (24–26 lines × 11) · ×1
  • Duplicated block (24–26 lines × 11) paddleocr/_pipelines/ocr.py:456 — paddleocr/_pipelines/ocr.py:456-479 | paddleocr/_pipelines/pp_chatocrv4_doc.py:492-515 | paddleocr/_pipelines/pp_chatocrv4_doc.py:542-565 | paddleocr/_pipelines/pp_doctranslation.py:611-636 | paddleocr/_pipelines/pp_doctranslation.py:659-683 | paddleocr/_pipelines/pp_doctranslation.py:781-805 | paddleocr/_pipelines/pp_structurev3.py:724-749 | paddleocr/_pipelines/pp_structurev3.py:772-796 | paddleocr/_pipelines/pp_structurev3.py:894-918 | paddleocr/_pipelines/seal_recognition.py:286-309 | paddleocr/_pipelines/table_recognition_v2.py:351-375 — before extracting anything, compare `paddleocr/_pipelines/ocr.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 9 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. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/ocr.py:456` 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 (24–26 lines × 4) · ×1
  • Duplicated block (24–26 lines × 4) paddleocr/_pipelines/paddleocr_vl.py:365 — paddleocr/_pipelines/paddleocr_vl.py:365-389 | paddleocr/_pipelines/pp_chatocrv4_doc.py:522-545 | paddleocr/_pipelines/pp_doctranslation.py:627-652 | paddleocr/_pipelines/pp_structurev3.py:740-765 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:365` 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 (25–26 lines × 2) · ×1
  • Duplicated block (25–26 lines × 2) REDACTED:1812 — REDACTED:1812-1837 | REDACTED:2128-2152 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (22–25 lines × 12) · ×1
  • Duplicated block (22–25 lines × 12) paddleocr/_pipelines/formula_recognition.py:187 — paddleocr/_pipelines/formula_recognition.py:187-208 | paddleocr/_pipelines/ocr.py:462-484 | paddleocr/_pipelines/pp_chatocrv4_doc.py:498-520 | paddleocr/_pipelines/pp_doctranslation.py:617-641 | paddleocr/_pipelines/pp_doctranslation.py:665-688 | paddleocr/_pipelines/pp_doctranslation.py:701-723 | paddleocr/_pipelines/pp_doctranslation.py:787-810 | paddleocr/_pipelines/pp_structurev3.py:730-754 | paddleocr/_pipelines/pp_structurev3.py:778-801 | paddleocr/_pipelines/pp_structurev3.py:814-836 | paddleocr/_pipelines/pp_structurev3.py:900-923 | paddleocr/_pipelines/table_recognition_v2.py:357-380 — there are 12 copies across 6 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 12 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/formula_recognition.py:187` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (23–25 lines × 8) · ×1
  • Duplicated block (23–25 lines × 8) paddleocr/_pipelines/formula_recognition.py:191 — paddleocr/_pipelines/formula_recognition.py:191-213 | paddleocr/_pipelines/ocr.py:467-489 | paddleocr/_pipelines/paddleocr_vl.py:361-384 | paddleocr/_pipelines/pp_chatocrv4_doc.py:503-525 | paddleocr/_pipelines/pp_doctranslation.py:623-647 | paddleocr/_pipelines/pp_doctranslation.py:706-728 | paddleocr/_pipelines/pp_structurev3.py:736-760 | paddleocr/_pipelines/pp_structurev3.py:819-841 — there are 8 copies across 6 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 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/formula_recognition.py:191` 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 (25 lines × 5) · ×1
  • Duplicated block (25 lines × 5) paddleocr/_pipelines/paddleocr_vl.py:333 — paddleocr/_pipelines/paddleocr_vl.py:333-357 | paddleocr/_pipelines/pp_doctranslation.py:606-630 | paddleocr/_pipelines/pp_doctranslation.py:730-754 | paddleocr/_pipelines/pp_structurev3.py:719-743 | paddleocr/_pipelines/pp_structurev3.py:843-867 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_doctranslation.py` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 301 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:333` 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 (24–25 lines × 3) · ×1
  • Duplicated block (24–25 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:516 — ppocr/modeling/heads/rec_ppformulanet_head.py:516-539 | ppocr/modeling/heads/rec_unimernet_head.py:1089-1112 | ppocr/modeling/heads/rec_unimernet_head.py:1762-1786 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/modeling/heads/rec_unimernet_head.py:1759` calls `counting_context_weight`, `unsqueeze` and `ppocr/modeling/heads/rec_ppformulanet_head.py:514` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) paddleocr/_api_client/cli.py:118 — paddleocr/_api_client/cli.py:118-142 | paddleocr/_api_client/cli.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. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_api_client/cli.py:118` 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 (24 lines × 11) · ×1
  • Duplicated block (24 lines × 11) paddleocr/_models/_text_detection.py:47 — paddleocr/_models/_text_detection.py:47-70 | paddleocr/_pipelines/ocr.py:511-534 | paddleocr/_pipelines/paddleocr_vl.py:461-484 | paddleocr/_pipelines/pp_chatocrv4_doc.py:613-636 | paddleocr/_pipelines/pp_chatocrv4_doc.py:643-666 | paddleocr/_pipelines/pp_doctranslation.py:680-703 | paddleocr/_pipelines/pp_doctranslation.py:802-825 | paddleocr/_pipelines/pp_structurev3.py:793-816 | paddleocr/_pipelines/pp_structurev3.py:915-938 | paddleocr/_pipelines/seal_recognition.py:346-369 | paddleocr/_pipelines/table_recognition_v2.py:372-395 — there are 11 copies across 8 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_models/_text_detection.py:47` 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 (24 lines × 4) · ×1
  • Duplicated block (24 lines × 4) ppocr/modeling/backbones/det_resnet_vd_sast.py:86 — ppocr/modeling/backbones/det_resnet_vd_sast.py:86-109 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:84-107 | ppocr/modeling/backbones/rec_resnet_fpn.py:243-266 | ppocr/modeling/backbones/rec_resnet_vd.py:86-109 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 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 (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) REDACTED:1848 — REDACTED:1848-1870 | REDACTED:2170-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (20–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) ppocr/data/imaug/pg_process.py:344 — ppocr/data/imaug/pg_process.py:344-367 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:100-119 — 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 (24 lines × 2) · ×1
  • Duplicated block (24 lines × 2) REDACTED:687 — REDACTED:687-710 | tools/infer/predict_rec.py:272-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (19–24 lines × 2) · ×1
  • Duplicated block (19–24 lines × 2) ppocr/modeling/backbones/rec_mv1_enhance.py:134 — ppocr/modeling/backbones/rec_mv1_enhance.py:134-157 | ppocr/modeling/backbones/rec_mv1_enhance.py:172-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/rec_mv1_enhance.py:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (22–23 lines × 9) · ×1
  • Duplicated block (22–23 lines × 9) deploy/hubserving/kie_ser/module.py:102 — deploy/hubserving/kie_ser/module.py:102-123 | deploy/hubserving/kie_ser_re/module.py:102-123 | deploy/hubserving/ocr_cls/module.py:98-120 | deploy/hubserving/ocr_det/module.py:100-122 | deploy/hubserving/ocr_rec/module.py:98-120 | deploy/hubserving/ocr_system/module.py:101-123 | deploy/hubserving/structure_layout/module.py:97-119 | deploy/hubserving/structure_system/module.py:100-122 | deploy/hubserving/structure_table/module.py:99-121 — `deploy/hubserving/kie_ser/module.py` and `deploy/hubserving/kie_ser_re/module.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 64 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 (22–23 lines × 7) · ×1
  • Duplicated block (22–23 lines × 7) paddleocr/_models/_object_detection.py:57 — paddleocr/_models/_object_detection.py:57-78 | paddleocr/_pipelines/formula_recognition.py:235-256 | paddleocr/_pipelines/paddleocr_vl.py:323-344 | paddleocr/_pipelines/pp_chatocrv4_doc.py:587-609 | paddleocr/_pipelines/pp_doctranslation.py:596-617 | paddleocr/_pipelines/pp_structurev3.py:709-730 | paddleocr/_pipelines/seal_recognition.py:321-342 — before extracting anything, compare `paddleocr/_pipelines/formula_recognition.py` and `paddleocr/_pipelines/paddleocr_vl.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_models/_object_detection.py:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–23 lines × 5) · ×1
  • Duplicated block (22–23 lines × 5) paddleocr/_pipelines/paddleocr_vl.py:401 — paddleocr/_pipelines/paddleocr_vl.py:401-423 | paddleocr/_pipelines/pp_chatocrv4_doc.py:562-583 | paddleocr/_pipelines/pp_doctranslation.py:858-880 | paddleocr/_pipelines/pp_structurev3.py:971-993 | paddleocr/_pipelines/table_recognition_v2.py:412-434 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:401` 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 (23 lines × 3) · ×1
  • Duplicated block (23 lines × 3) ppocr/modeling/backbones/det_resnet_vd_sast.py:147 — ppocr/modeling/backbones/det_resnet_vd_sast.py:147-169 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:145-167 | ppocr/modeling/backbones/rec_resnet_vd.py:148-170 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd_sast.py` and `ppocr/modeling/backbones/e2e_resnet_vd_pg.py` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 266 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/det_resnet_vd_sast.py:147` 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 (21–22 lines × 11) · ×1
  • Duplicated block (21–22 lines × 11) paddleocr/_pipelines/doc_preprocessor.py:114 — paddleocr/_pipelines/doc_preprocessor.py:114-134 | paddleocr/_pipelines/ocr.py:434-454 | paddleocr/_pipelines/paddleocr_vl.py:373-394 | paddleocr/_pipelines/pp_chatocrv4_doc.py:460-480 | paddleocr/_pipelines/pp_chatocrv4_doc.py:530-550 | paddleocr/_pipelines/pp_doctranslation.py:636-657 | paddleocr/_pipelines/pp_doctranslation.py:739-759 | paddleocr/_pipelines/pp_structurev3.py:749-770 | paddleocr/_pipelines/pp_structurev3.py:852-872 | paddleocr/_pipelines/seal_recognition.py:254-274 | paddleocr/_pipelines/table_recognition_v2.py:278-298 — before extracting anything, compare `paddleocr/_pipelines/doc_preprocessor.py` and `paddleocr/_pipelines/ocr.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/doc_preprocessor.py:114` 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 (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) ppocr/data/imaug/unimernet_aug.py:517 — ppocr/data/imaug/unimernet_aug.py:517-538 | ppocr/data/imaug/unimernet_aug.py:624-645 | ppocr/data/imaug/unimernet_aug.py:756-777 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) deploy/slim/quantization/export_model.py:168 — deploy/slim/quantization/export_model.py:168-183 | ppocr/utils/export_model.py:523-544 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/utils/export_model.py:523` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `ppocr/utils/export_model.py:522` calls `dump_infer_config` and `deploy/slim/quantization/export_model.py:166` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) REDACTED:390 — REDACTED:390-411 | ppocr/utils/e2e_utils/visual.py:20-40 — before extracting anything, compare `REDACTED` and `ppocr/utils/e2e_utils/visual.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) ppocr/modeling/necks/fce_fpn.py:159 — ppocr/modeling/necks/fce_fpn.py:159-179 | ppocr/modeling/necks/fce_fpn.py:187-207 | ppocr/modeling/necks/fce_fpn.py:223-243 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/fce_fpn.py:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 12) · ×1
  • Duplicated block (20 lines × 12) configs/rec/multi_language/generate_multi_language_configs.py:149 — configs/rec/multi_language/generate_multi_language_configs.py:149-168 | paddleocr/_pipelines/doc_preprocessor.py:113-132 | paddleocr/_pipelines/ocr.py:433-452 | paddleocr/_pipelines/paddleocr_vl.py:372-392 | paddleocr/_pipelines/pp_chatocrv4_doc.py:459-478 | paddleocr/_pipelines/pp_chatocrv4_doc.py:529-548 | paddleocr/_pipelines/pp_doctranslation.py:635-655 | paddleocr/_pipelines/pp_doctranslation.py:738-757 | paddleocr/_pipelines/pp_structurev3.py:748-768 | paddleocr/_pipelines/pp_structurev3.py:851-870 | paddleocr/_pipelines/seal_recognition.py:253-272 | paddleocr/_pipelines/table_recognition_v2.py:277-296 — before extracting anything, compare `paddleocr/_pipelines/doc_preprocessor.py` and `paddleocr/_pipelines/ocr.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 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 lines × 11) · ×1
  • Duplicated block (20 lines × 11) paddleocr/_pipelines/ocr.py:436 — paddleocr/_pipelines/ocr.py:436-455 | paddleocr/_pipelines/paddleocr_vl.py:338-358 | paddleocr/_pipelines/paddleocr_vl.py:370-390 | paddleocr/_pipelines/pp_chatocrv4_doc.py:456-476 | paddleocr/_pipelines/pp_chatocrv4_doc.py:527-546 | paddleocr/_pipelines/pp_doctranslation.py:632-653 | paddleocr/_pipelines/pp_doctranslation.py:735-755 | paddleocr/_pipelines/pp_structurev3.py:745-766 | paddleocr/_pipelines/pp_structurev3.py:848-868 | paddleocr/_pipelines/seal_recognition.py:256-275 | paddleocr/_pipelines/table_recognition_v2.py:280-299 — there are 11 copies across 7 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/ocr.py:436` 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 (19 lines × 13) · ×1
  • Duplicated block (19 lines × 13) configs/rec/multi_language/generate_multi_language_configs.py:148 — configs/rec/multi_language/generate_multi_language_configs.py:148-167 | paddleocr/_pipelines/doc_preprocessor.py:113-131 | paddleocr/_pipelines/ocr.py:433-451 | paddleocr/_pipelines/paddleocr_vl.py:339-359 | paddleocr/_pipelines/paddleocr_vl.py:371-391 | paddleocr/_pipelines/pp_chatocrv4_doc.py:457-477 | paddleocr/_pipelines/pp_chatocrv4_doc.py:528-547 | paddleocr/_pipelines/pp_doctranslation.py:633-654 | paddleocr/_pipelines/pp_doctranslation.py:736-756 | paddleocr/_pipelines/pp_structurev3.py:746-767 | paddleocr/_pipelines/pp_structurev3.py:849-869 | paddleocr/_pipelines/seal_recognition.py:253-271 | paddleocr/_pipelines/table_recognition_v2.py:277-295 — before extracting anything, compare `paddleocr/_pipelines/doc_preprocessor.py` and `paddleocr/_pipelines/ocr.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `configs/rec/multi_language/generate_multi_language_configs.py:148` 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 × 9) · ×1
  • Duplicated block (18–19 lines × 9) deploy/hubserving/kie_ser/module.py:50 — deploy/hubserving/kie_ser/module.py:50-68 | deploy/hubserving/kie_ser_re/module.py:50-68 | deploy/hubserving/ocr_cls/module.py:46-64 | deploy/hubserving/ocr_det/module.py:48-66 | deploy/hubserving/ocr_rec/module.py:46-64 | deploy/hubserving/ocr_system/module.py:49-67 | deploy/hubserving/structure_layout/module.py:48-65 | deploy/hubserving/structure_system/module.py:50-68 | deploy/hubserving/structure_table/module.py:50-67 — `deploy/hubserving/kie_ser/module.py` and `deploy/hubserving/kie_ser_re/module.py` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 64 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 (18–19 lines × 3) · ×1
  • Duplicated block (18–19 lines × 3) ppocr/data/imaug/unimernet_aug.py:489 — ppocr/data/imaug/unimernet_aug.py:489-506 | ppocr/data/imaug/unimernet_aug.py:596-613 | ppocr/data/imaug/unimernet_aug.py:727-745 — 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 (17–19 lines × 3) · ×1
  • Duplicated block (17–19 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:496 — ppocr/modeling/heads/rec_ppformulanet_head.py:496-514 | ppocr/modeling/heads/rec_unimernet_head.py:1072-1088 | ppocr/modeling/heads/rec_unimernet_head.py:1739-1755 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/rec_ppformulanet_head.py:496` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/heads/rec_unimernet_head.py:1759` calls `counting_context_weight`, `unsqueeze` and `ppocr/modeling/heads/rec_ppformulanet_head.py:516` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:938 — ppocr/modeling/heads/rec_ppformulanet_head.py:938-954 | ppocr/modeling/heads/rec_unimernet_head.py:2380-2397 | ppocr/modeling/heads/rec_unimernet_head.py:2615-2631 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) paddleocr/_doc2md/converters/docx.py:634 — paddleocr/_doc2md/converters/docx.py:634-651 | paddleocr/_doc2md/converters/pptx.py:124-138 — 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 (4–18 lines × 3) · ×1
  • Duplicated block (4–18 lines × 3) ppocr/losses/rec_ce_loss.py:44 — ppocr/losses/rec_ce_loss.py:44-61 | ppocr/losses/rec_cppd_loss.py:43-46 | ppocr/losses/rec_nrtr_loss.py:16-33 — 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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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 × 3) · ×1
  • Duplicated block (15–17 lines × 3) ppocr/modeling/backbones/det_resnet.py:135 — ppocr/modeling/backbones/det_resnet.py:135-149 | ppocr/modeling/backbones/det_resnet_vd.py:269-285 | ppocr/modeling/backbones/rec_resnet_vd.py:197-213 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) ppocr/modeling/heads/det_east_head.py:39 — ppocr/modeling/heads/det_east_head.py:39-55 | ppocr/modeling/heads/e2e_pg_head.py:39-55 | ppocr/modeling/necks/east_fpn.py:38-54 — before extracting anything, compare `ppocr/modeling/heads/det_east_head.py` and `ppocr/modeling/heads/e2e_pg_head.py` as WHOLE FILES: this scan already matched 3 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_east_head.py:39` 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 (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) ppocr/data/imaug/pg_process.py:806 — ppocr/data/imaug/pg_process.py:806-820 | ppocr/data/imaug/sast_process.py:582-598 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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 (16 lines × 12) · ×1
  • Duplicated block (16 lines × 12) paddleocr/_pipelines/paddleocr_vl.py:140 — paddleocr/_pipelines/paddleocr_vl.py:140-155 | paddleocr/_pipelines/paddleocr_vl.py:198-213 | paddleocr/_pipelines/pp_chatocrv4_doc.py:140-155 | paddleocr/_pipelines/pp_chatocrv4_doc.py:194-209 | paddleocr/_pipelines/pp_doctranslation.py:158-173 | paddleocr/_pipelines/pp_doctranslation.py:230-245 | paddleocr/_pipelines/pp_structurev3.py:206-221 | paddleocr/_pipelines/pp_structurev3.py:282-297 | paddleocr/_pipelines/seal_recognition.py:109-124 | paddleocr/_pipelines/seal_recognition.py:149-164 | paddleocr/_pipelines/table_recognition_v2.py:102-117 | paddleocr/_pipelines/table_recognition_v2.py:150-165 — before extracting anything, compare `paddleocr/_pipelines/paddleocr_vl.py` and `paddleocr/_pipelines/pp_chatocrv4_doc.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 224 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `paddleocr/_pipelines/paddleocr_vl.py:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `paddleocr/_pipelines/pp_structurev3.py:300` calls `concatenate_markdown_pages` and `paddleocr/_pipelines/seal_recognition.py:167` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) ppocr/losses/distillation_loss.py:622 — ppocr/losses/distillation_loss.py:622-637 | ppocr/losses/distillation_loss.py:652-667 | ppocr/losses/distillation_loss.py:687-702 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (4–16 lines × 3) · ×1
  • Duplicated block (4–16 lines × 3) ppocr/data/imaug/east_process.py:128 — ppocr/data/imaug/east_process.py:128-131 | ppocr/data/imaug/pg_process.py:121-136 | ppocr/data/imaug/sast_process.py:100-115 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–15 lines × 4) · ×1
  • Duplicated block (12–15 lines × 4) ppocr/modeling/backbones/rec_resnet_32.py:109 — ppocr/modeling/backbones/rec_resnet_32.py:109-123 | ppocr/modeling/backbones/rec_resnet_45.py:71-85 | ppocr/modeling/backbones/rec_resnet_aster.py:65-76 | ppocr/modeling/backbones/rec_resnet_rfl.py:70-84 — before extracting anything, compare `ppocr/modeling/backbones/rec_resnet_32.py` and `ppocr/modeling/backbones/rec_resnet_rfl.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (4–15 lines × 5) · ×1
  • Duplicated block (4–15 lines × 5) ppocr/data/imaug/east_process.py:292 — ppocr/data/imaug/east_process.py:292-306 | ppocr/data/imaug/fce_aug.py:213-216 | ppocr/data/imaug/pg_process.py:158-172 | ppocr/data/imaug/random_crop_data.py:420-423 | ppocr/data/imaug/sast_process.py:135-149 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/data/imaug/east_process.py:307` calls `round`, `astype`, `min` and `ppocr/data/imaug/fce_aug.py:216` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–14 lines × 6) · ×1
  • Duplicated block (13–14 lines × 6) ppocr/postprocess/rec_postprocess.py:299 — ppocr/postprocess/rec_postprocess.py:299-311 | ppocr/postprocess/rec_postprocess.py:377-389 | ppocr/postprocess/rec_postprocess.py:474-486 | ppocr/postprocess/rec_postprocess.py:556-569 | ppocr/postprocess/rec_postprocess.py:722-734 | ppocr/postprocess/rec_postprocess.py:797-809 — 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. 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 (14 lines × 5) · ×1
  • Duplicated block (14 lines × 5) ppocr/modeling/backbones/rec_lcnetv3.py:438 — ppocr/modeling/backbones/rec_lcnetv3.py:438-451 | ppocr/modeling/backbones/rec_lcnetv3.py:454-467 | ppocr/modeling/backbones/rec_lcnetv3.py:470-483 | ppocr/modeling/backbones/rec_lcnetv3.py:486-499 | ppocr/modeling/backbones/rec_lcnetv3.py:502-515 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/backbones/rec_lcnetv3.py:438` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 5) · ×1
  • Duplicated block (13–14 lines × 5) ppocr/modeling/heads/det_east_head.py:43 — ppocr/modeling/heads/det_east_head.py:43-56 | ppocr/modeling/heads/e2e_pg_head.py:43-56 | ppocr/modeling/necks/east_fpn.py:42-55 | ppocr/modeling/necks/east_fpn.py:84-96 | ppocr/modeling/necks/pg_fpn.py:91-103 — before extracting anything, compare `ppocr/modeling/heads/det_east_head.py` and `ppocr/modeling/heads/e2e_pg_head.py` as WHOLE FILES: this scan already matched 3 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_east_head.py:43` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) ppocr/postprocess/locality_aware_nms.py:56 — ppocr/postprocess/locality_aware_nms.py:56-67 | ppocr/postprocess/locality_aware_nms.py:73-86 | ppocr/postprocess/locality_aware_nms.py:90-103 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) ppstructure/table/table_metric/table_metric.py:64 — ppstructure/table/table_metric/table_metric.py:64-77 | ppstructure/table/table_metric/table_metric.py:88-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (11–13 lines × 5) · ×1
  • Duplicated block (11–13 lines × 5) REDACTED:377 — REDACTED:377-387 | REDACTED:405-417 | ppocr/utils/e2e_utils/visual.py:34-46 | ppocr/utils/e2e_utils/visual.py:59-70 | ppocr/utils/e2e_utils/visual.py:81-92 — before extracting anything, compare `REDACTED` and `ppocr/utils/e2e_utils/visual.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) deploy/avh/convert_image.py:37 — deploy/avh/convert_image.py:37-49 | REDACTED:640-652 | REDACTED:667-679 | tools/infer/predict_rec.py:441-453 — before extracting anything, compare `deploy/avh/convert_image.py` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 4) · ×1
  • Duplicated block (12–13 lines × 4) ppocr/losses/distillation_loss.py:200 — ppocr/losses/distillation_loss.py:200-211 | ppocr/losses/distillation_loss.py:309-321 | ppocr/losses/distillation_loss.py:454-465 | ppocr/losses/distillation_loss.py:563-575 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/losses/distillation_loss.py:200` 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 (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) ppocr/modeling/heads/rec_att_head.py:74 — ppocr/modeling/heads/rec_att_head.py:74-84 | ppocr/modeling/heads/rec_att_head.py:170-182 | ppocr/modeling/heads/rec_spin_att_head.py:81-91 — before extracting anything, compare `ppocr/modeling/heads/rec_att_head.py` and `ppocr/modeling/heads/rec_spin_att_head.py` 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. 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) ppocr/modeling/heads/rec_ppformulanet_head.py:1133 — ppocr/modeling/heads/rec_ppformulanet_head.py:1133-1145 | ppocr/modeling/heads/rec_ppformulanet_head.py:1251-1263 | ppocr/modeling/heads/rec_unimernet_head.py:2458-2469 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/modeling/heads/rec_ppformulanet_head.py:1265` calls `concat` and `ppocr/modeling/heads/rec_unimernet_head.py:2470` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–12 lines × 8) · ×1
  • Duplicated block (11–12 lines × 8) ppocr/modeling/heads/det_east_head.py:48 — ppocr/modeling/heads/det_east_head.py:48-59 | ppocr/modeling/heads/det_sast_head.py:47-58 | ppocr/modeling/heads/e2e_pg_head.py:48-59 | ppocr/modeling/necks/east_fpn.py:47-58 | ppocr/modeling/necks/east_fpn.py:89-99 | ppocr/modeling/necks/pg_fpn.py:96-106 | ppocr/modeling/necks/sast_fpn.py:46-57 | ppocr/modeling/necks/sast_fpn.py:87-97 — before extracting anything, compare `ppocr/modeling/heads/det_east_head.py` and `ppocr/modeling/heads/e2e_pg_head.py` as WHOLE FILES: this scan already matched 3 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_east_head.py:48` 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 (11–12 lines × 5) · ×1
  • Duplicated block (11–12 lines × 5) ppocr/modeling/backbones/det_resnet.py:75 — ppocr/modeling/backbones/det_resnet.py:75-86 | ppocr/modeling/backbones/det_resnet_vd.py:202-212 | ppocr/modeling/backbones/det_resnet_vd_sast.py:124-134 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:122-132 | ppocr/modeling/backbones/rec_resnet_vd.py:124-135 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (4–12 lines × 3) · ×1
  • Duplicated block (4–12 lines × 3) ppocr/data/imaug/pg_process.py:406 — ppocr/data/imaug/pg_process.py:406-417 | ppocr/data/imaug/sast_process.py:210-221 | ppocr/postprocess/sast_postprocess.py:177-180 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/postprocess/sast_postprocess.py:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (10–11 lines × 5) · ×1
  • Duplicated block (10–11 lines × 5) ppocr/losses/distillation_loss.py:206 — ppocr/losses/distillation_loss.py:206-215 | ppocr/losses/distillation_loss.py:315-325 | ppocr/losses/distillation_loss.py:371-380 | ppocr/losses/distillation_loss.py:460-469 | ppocr/losses/distillation_loss.py:569-579 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/losses/distillation_loss.py:206` 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 (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) ppocr/modeling/backbones/det_resnet_vd.py:267 — ppocr/modeling/backbones/det_resnet_vd.py:267-277 | ppocr/modeling/backbones/det_resnet_vd_sast.py:194-204 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:192-202 | ppocr/modeling/backbones/rec_resnet_vd.py:195-205 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet_vd.py` and `ppocr/modeling/backbones/det_resnet_vd_sast.py` as WHOLE FILES: this scan already matched 8 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 (9–11 lines × 4) · ×1
  • Duplicated block (9–11 lines × 4) ppocr/modeling/heads/det_sast_head.py:72 — ppocr/modeling/heads/det_sast_head.py:72-82 | ppocr/modeling/heads/det_sast_head.py:84-94 | ppocr/modeling/heads/det_sast_head.py:108-116 | ppocr/modeling/heads/det_sast_head.py:118-126 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/heads/det_sast_head.py:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) ppstructure/kie/predict_kie_token_ser.py:146 — ppstructure/kie/predict_kie_token_ser.py:146-156 | ppstructure/kie/predict_kie_token_ser_re.py:90-100 | ppstructure/table/predict_structure.py:172-181 — 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 (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) ppocr/modeling/heads/rec_ppformulanet_head.py:258 — ppocr/modeling/heads/rec_ppformulanet_head.py:258-268 | ppocr/modeling/heads/rec_unimernet_head.py:381-389 — before extracting anything, compare `ppocr/modeling/heads/rec_ppformulanet_head.py` and `ppocr/modeling/heads/rec_unimernet_head.py` as WHOLE FILES: this scan already matched 27 separate duplicated blocks between them, totalling at least 561 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 (9–10 lines × 6) · ×1
  • Duplicated block (9–10 lines × 6) deploy/avh/convert_image.py:41 — deploy/avh/convert_image.py:41-49 | REDACTED:613-622 | REDACTED:644-652 | REDACTED:671-679 | tools/infer/predict_rec.py:376-385 | tools/infer/predict_rec.py:445-453 — before extracting anything, compare `deploy/avh/convert_image.py` and `REDACTED` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 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) · ×1
  • Duplicated block (8–10 lines × 2) ppocr/data/imaug/pg_process.py:421 — ppocr/data/imaug/pg_process.py:421-428 | ppocr/data/imaug/sast_process.py:225-234 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/data/imaug/pg_process.py:421` 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 (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) deploy/slim/quantization/export_model.py:75 — deploy/slim/quantization/export_model.py:75-83 | deploy/slim/quantization/quant.py:109-117 | ppocr/utils/export_model.py:428-436 | tools/train.py:80-88 — before extracting anything, compare `deploy/slim/quantization/export_model.py` and `deploy/slim/quantization/quant.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) paddleocr/_doc2md/converters/docx.py:868 — paddleocr/_doc2md/converters/docx.py:868-876 | paddleocr/_doc2md/converters/docx.py:1195-1203 | paddleocr/_doc2md/converters/docx.py:1372-1378 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `paddleocr/_doc2md/converters/docx.py:1371` calls `flush_code_buf` and `paddleocr/_doc2md/converters/docx.py:867` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) REDACTED:337 — REDACTED:337-344 | REDACTED:378-385 | REDACTED:407-414 | ppocr/utils/e2e_utils/visual.py:36-43 | ppocr/utils/e2e_utils/visual.py:61-68 | ppocr/utils/e2e_utils/visual.py:83-90 — before extracting anything, compare `REDACTED` and `ppocr/utils/e2e_utils/visual.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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 (2–8 lines × 5) · ×1
  • Duplicated block (2–8 lines × 5) ppocr/modeling/necks/db_fpn.py:209 — ppocr/modeling/necks/db_fpn.py:209-210 | ppocr/modeling/necks/db_fpn.py:293-300 | ppocr/modeling/necks/db_fpn.py:408-415 | ppocr/modeling/necks/db_fpn.py:540-547 | ppocr/modeling/necks/db_fpn.py:929-936 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–8 lines × 3) · ×1
  • Duplicated block (6–8 lines × 3) ppocr/data/lmdb_dataset.py:167 — ppocr/data/lmdb_dataset.py:167-174 | ppocr/data/lmdb_dataset.py:227-234 | ppocr/data/lmdb_dataset.py:322-327 — 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `ppocr/data/lmdb_dataset.py:177` calls `get_ext_data` and `ppocr/data/lmdb_dataset.py:328` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) ppocr/losses/distillation_loss.py:102 — ppocr/losses/distillation_loss.py:102-108 | ppocr/losses/distillation_loss.py:198-204 | ppocr/losses/distillation_loss.py:306-313 | ppocr/losses/distillation_loss.py:363-369 | ppocr/losses/distillation_loss.py:452-458 | ppocr/losses/distillation_loss.py:560-567 — 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 (2–7 lines × 3) · ×1
  • Duplicated block (2–7 lines × 3) ppocr/data/imaug/east_process.py:178 — ppocr/data/imaug/east_process.py:178-179 | ppocr/data/imaug/pg_process.py:641-647 | ppocr/data/imaug/sast_process.py:426-432 — 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 (4–7 lines × 4) · ×1
  • Duplicated block (4–7 lines × 4) ppocr/modeling/necks/db_fpn.py:252 — ppocr/modeling/necks/db_fpn.py:252-255 | ppocr/modeling/necks/db_fpn.py:343-346 | ppocr/modeling/necks/db_fpn.py:497-503 | ppocr/modeling/necks/db_fpn.py:886-892 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/modeling/necks/db_fpn.py:252` 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 (2–5 lines × 6) · ×1
  • Duplicated block (2–5 lines × 6) ppocr/data/imaug/pg_process.py:702 — ppocr/data/imaug/pg_process.py:702-708 | ppocr/data/imaug/sast_process.py:487-493 | ppocr/postprocess/sast_postprocess.py:68-74 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:329-330 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:62-66 | ppocr/utils/e2e_utils/visual.py:119-123 — before extracting anything, compare `ppocr/data/imaug/pg_process.py` and `ppocr/data/imaug/sast_process.py` as WHOLE FILES: this scan already matched 39 separate duplicated blocks between them, totalling at least 497 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–5 lines × 8) · ×1
  • Duplicated block (4–5 lines × 8) ppocr/data/imaug/east_process.py:320 — ppocr/data/imaug/east_process.py:320-324 | ppocr/data/imaug/east_process.py:326-329 | ppocr/data/imaug/fce_aug.py:111-114 | ppocr/data/imaug/fce_aug.py:116-119 | ppocr/data/imaug/pg_process.py:185-189 | ppocr/data/imaug/pg_process.py:191-194 | ppocr/data/imaug/sast_process.py:162-166 | ppocr/data/imaug/sast_process.py:168-171 — there are 8 copies across 4 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 8 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) ppocr/modeling/heads/rec_nrtr_head.py:509 — ppocr/modeling/heads/rec_nrtr_head.py:509-513 | ppocr/modeling/heads/rec_nrtr_head.py:556-560 | ppocr/modeling/heads/sr_rensnet_transformer.py:224-226 — 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 `ppocr/modeling/heads/rec_nrtr_head.py:509` 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 (8 lines × 7) · ×1
  • Duplicated block (8 lines × 7) ppocr/losses/distillation_loss.py:69 — ppocr/losses/distillation_loss.py:69-76 | ppocr/losses/distillation_loss.py:165-172 | ppocr/losses/distillation_loss.py:273-280 | ppocr/losses/distillation_loss.py:419-426 | ppocr/losses/distillation_loss.py:527-534 | ppocr/losses/distillation_loss.py:1164-1171 | test_tipc/supplementary/loss.py:108-115 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×1
  • Duplicated block (10 lines × 5) ppocr/modeling/backbones/det_resnet.py:115 — ppocr/modeling/backbones/det_resnet.py:115-124 | ppocr/modeling/backbones/det_resnet_vd.py:249-258 | ppocr/modeling/backbones/det_resnet_vd_sast.py:178-187 | ppocr/modeling/backbones/e2e_resnet_vd_pg.py:176-185 | ppocr/modeling/backbones/rec_resnet_vd.py:179-188 — before extracting anything, compare `ppocr/modeling/backbones/det_resnet.py` and `ppocr/modeling/backbones/det_resnet_vd.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Near-duplicate member family (3 members, 55 shared lines) · ×1
  • Near-duplicate member family (3 members, 55 shared lines) REDACTED:88 — REDACTED:88-196 | REDACTED:200-313 | REDACTED:317-446 — These 3 members are variants of one another: a block of 55 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 3 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 3 times.
D4 · Code Duplication · Near-duplicate member pair (121 shared lines) · ×1
  • Near-duplicate member pair (121 shared lines) ppocr/utils/e2e_metric/Deteval.py:25 — ppocr/utils/e2e_metric/Deteval.py:25-175 | ppocr/utils/e2e_metric/Deteval.py:179-306 — These two members are variants of one another: 121 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 (16 corresponding lines) · ×1
  • Edited copy of a member (16 corresponding lines) ppocr/utils/e2e_utils/pgnet_pp_utils.py:48 — ppocr/utils/e2e_utils/pgnet_pp_utils.py:48-86 | ppocr/utils/e2e_utils/pgnet_pp_utils.py:89-179 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) ppocr/utils/e2e_metric/Deteval.py:78 — ppocr/utils/e2e_metric/Deteval.py:78-123 | ppocr/utils/e2e_metric/Deteval.py:209-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.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) ppocr/utils/e2e_utils/extract_textpoint_fast.py:277 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:277-313 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:306-342 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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 (25–27 lines × 4) · ×1
  • Duplicated block (25–27 lines × 4) ppocr/utils/e2e_utils/extract_textpoint_fast.py:170 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:170-194 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:497-523 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:197-221 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:560-586 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 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. 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 (23–25 lines × 4) · ×1
  • Duplicated block (23–25 lines × 4) ppocr/utils/e2e_utils/extract_textpoint_fast.py:210 — ppocr/utils/e2e_utils/extract_textpoint_fast.py:210-232 | ppocr/utils/e2e_utils/extract_textpoint_fast.py:258-281 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:237-260 | ppocr/utils/e2e_utils/extract_textpoint_slow.py:286-310 — before extracting anything, compare `ppocr/utils/e2e_utils/extract_textpoint_fast.py` and `ppocr/utils/e2e_utils/extract_textpoint_slow.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 288 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `ppocr/utils/e2e_utils/extract_textpoint_fast.py:210` 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 (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) REDACTED:154 — REDACTED:154-175 | REDACTED:268-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:268` 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 (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) ppocr/utils/e2e_metric/Deteval.py:153 — ppocr/utils/e2e_metric/Deteval.py:153-175 | ppocr/utils/e2e_metric/Deteval.py:284-306 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: ppocr-android:ppocr-sdk — ppocr-android:ppocr-sdk: abstractness 0.03, instability 0.00, distance 0.97 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
D6 · Cohesion (LCOM4) · Low cohesion · ×1
  • Low cohesion: InferenceEngine (LCOM4 4) benchmark/PaddleOCR_DBNet/tools/infer.py:35 — InferenceEngine'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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×1
  • Outbound HTTP without resilience ppocr/utils/network.py:70 — `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
R10 · Code Duplication · Duplicated block with local edits (103 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (103 matched lines × 2 locations) paddleocr-js/packages/core/src/models/det.ts:205 — paddleocr-js/packages/core/src/models/det.ts:205 · paddleocr-js/packages/core/src/models/rec.ts:114 — the two spans are one implementation copied and then locally edited — 648 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (25 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (25 matched lines × 2 locations) paddleocr-js/packages/core/src/models/det.ts:119 — paddleocr-js/packages/core/src/models/det.ts:119 · paddleocr-js/packages/core/src/models/rec.ts:68 — the two spans are one implementation copied and then locally edited — 153 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×1
  • Duplicated block (13 lines × 2 locations) api_sdk/typescript/src/client.ts:273 — api_sdk/typescript/src/client.ts:273 · api_sdk/typescript/src/client.ts:298 — 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 (12 lines × 2 locations) · ×1
  • Duplicated block (12 lines × 2 locations) paddleocr-js/packages/core/src/platform/browser.ts:81 — paddleocr-js/packages/core/src/platform/browser.ts:81 · paddleocr-js/packages/core/src/platform/worker.ts:42 — 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) paddleocr-js/packages/core/src/models/common.ts:159 — paddleocr-js/packages/core/src/models/common.ts:159 · paddleocr-js/packages/core/src/models/common.ts: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.
R10 · Code Duplication · Duplicated block (5 lines × 2 locations) · ×1
  • Duplicated block (5 lines × 2 locations) api_sdk/typescript/src/client.ts:79 — api_sdk/typescript/src/client.ts:79 · api_sdk/typescript/src/client.ts:85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R2 · Cyclomatic Complexity · Complex function predict (cyclomatic 25, cognitive 37) · ×1
  • Complex function predict (cyclomatic 25, cognitive 37) paddleocr-js/packages/core/src/pipelines/ocr/core.ts:197 — predict has cyclomatic complexity 25 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeOcrPipelineConfig (cyclomatic 25, cognitive 24) · ×1
  • Complex function normalizeOcrPipelineConfig (cyclomatic 25, cognitive 24) paddleocr-js/packages/core/src/pipelines/ocr/config.ts:133 — normalizeOcrPipelineConfig has cyclomatic complexity 25 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetch (cyclomatic 21, cognitive 24) · ×1
  • Complex function fetch (cyclomatic 21, cognitive 24) api_sdk/typescript/src/internal/http.ts:178 — fetch has cyclomatic complexity 21 and cognitive complexity 24; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function decodeDetOutput (cyclomatic 15, cognitive 25) · ×1
  • Complex function decodeDetOutput (cyclomatic 15, cognitive 25) paddleocr-js/packages/core/src/models/det.ts:468 — decodeDetOutput has cyclomatic complexity 15 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function readExplicitPipelineRuntimeDefaults (cyclomatic 15, cognitive 20) · ×1
  • Complex function readExplicitPipelineRuntimeDefaults (cyclomatic 15, cognitive 20) paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:210 — readExplicitPipelineRuntimeDefaults has cyclomatic complexity 15 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function drawTextPanel (cyclomatic 12, cognitive 22) · ×1
  • Complex function drawTextPanel (cyclomatic 12, cognitive 22) paddleocr-js/packages/core/src/viz/ocr/draw-text.ts:74 — drawTextPanel has cyclomatic complexity 12 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function similar (cyclomatic 11, cognitive 13) · ×1
  • Complex function similar (cyclomatic 11, cognitive 13) test_tipc/web/index.test.js:50 — similar has cyclomatic complexity 11 and cognitive complexity 13; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 parseDetModelConfigText (cyclomatic 11, cognitive 10) · ×1
  • Complex function parseDetModelConfigText (cyclomatic 11, cognitive 10) paddleocr-js/packages/core/src/models/det.ts:119 — parseDetModelConfigText 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 · paddleocr-js/packages/core/src/pipelines/ocr/shared.ts · ×1
  • paddleocr-js/packages/core/src/pipelines/ocr/shared.ts: 579 lines of code paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:1 — paddleocr-js/packages/core/src/pipelines/ocr/shared.ts has 579 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · paddleocr-js/packages/core/src/models/det.ts · ×1
  • paddleocr-js/packages/core/src/models/det.ts: 507 lines of code paddleocr-js/packages/core/src/models/det.ts:1 — paddleocr-js/packages/core/src/models/det.ts has 507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~78 LoC) · ×1
  • Dead file (~78 LoC) paddleocr-js/packages/core/src/types/index.ts — no import path from any entry point (4 application, 8 tooling, 39 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
S1 · Web-Security Posture · Third-party script without Subresource Integrity · ×1
  • Third-party script without Subresource Integrity overrides/partials/comments.html:5 — `https://giscus.app/client.js` 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.
X24 · Document value interpolated into markup unescaped · Document value reaches a markup attribute unescaped · ×1
  • Document value reaches a markup attribute unescaped paddleocr/_doc2md/converters/docx.py:1120 — `name` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `name` at this site, or validate it against the shape the position accepts before interpolating it.
Minor — 461 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×336
  • Orphaned file REDACTED: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 ppocr/modeling/heads/rec_ppformulanet_head.py: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 ppocr/modeling/backbones/rec_donut_swin.py: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 ppocr/losses/distillation_loss.py: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 ppocr/data/imaug/pg_process.py: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 ppocr/modeling/backbones/rec_resnetv2.py: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 tools/infer/predict_rec.py: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 ppocr/modeling/necks/db_fpn.py: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 REDACTED: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 ppocr/utils/e2e_metric/Deteval.py: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 ppocr/modeling/heads/rec_latexocr_head.py: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 ppocr/data/imaug/drrg_targets.py: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 ppocr/data/imaug/sast_process.py: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 REDACTED: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 ppocr/data/imaug/unimernet_aug.py: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 ppocr/modeling/heads/rec_nrtr_head.py: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 ppocr/data/imaug/fce_targets.py: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 ppocr/modeling/heads/rec_robustscanner_head.py: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 REDACTED: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 REDACTED: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 ppocr/utils/e2e_utils/extract_textpoint_slow.py: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 ppocr/modeling/backbones/rec_vary_vit.py: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 paddleocr/_doc2md/converters/pptx.py: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 ppocr/modeling/backbones/rec_lcnetv4.py: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 deploy/android_demo/app/src/main/java/com/baidu/paddle/lite/demo/ocr/MainActivity.java: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.
  • + 311 more in this group — see findings.md.
M4 · Documentation accuracy · README/code drift · ×40
  • README/code drift deploy/README.md:24 — deploy/README.md links to `../doc/doc_en/inference_ppocr_en.md`, but `doc/doc_en/inference_ppocr_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/README.md:25 — deploy/README.md links to `./cpp_infer/readme.md`, but `deploy/cpp_infer/readme.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/README.md:26 — deploy/README.md links to `./pdserving/README.md`, but `deploy/pdserving/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/README.md:30 — deploy/README.md links to `../doc/doc_en/algorithm_overview_en.md`, but `doc/doc_en/algorithm_overview_en.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/FAQ.md:885 — docs/FAQ.md documents the environment variable `PADDLE_PDX_LOCAL_FONT_FILE_PATH`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ar.md:259 — readme/README_ar.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ar.md:280 — readme/README_ar.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_cn.md:281 — readme/README_cn.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_es.md:257 — readme/README_es.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_es.md:278 — readme/README_es.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_fr.md:257 — readme/README_fr.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_fr.md:278 — readme/README_fr.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ja.md:258 — readme/README_ja.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ja.md:279 — readme/README_ja.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ko.md:258 — readme/README_ko.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ko.md:279 — readme/README_ko.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ru.md:257 — readme/README_ru.md links to `./awesome_projects.md`, but `readme/awesome_projects.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_ru.md:278 — readme/README_ru.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift readme/README_tcn.md:278 — readme/README_tcn.md links to `LICENSE`, but `readme/LICENSE` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift test_tipc/readme.md:133 — test_tipc/readme.md names `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt`, but no file or folder `train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu.txt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift api_sdk/go/README_cn.md:18 — api_sdk/go/README_cn.md names `api_sdk/go/v0.1.0`, but no file or folder `api_sdk/go/v0.1.0` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift benchmark/PaddleOCR_DBNet/README.MD:64 — benchmark/PaddleOCR_DBNet/README.MD links to `cconfig/icdar2015_resnet18_fpn_DBhead_polyLR.yaml`, but `benchmark/PaddleOCR_DBNet/cconfig/icdar2015_resnet18_fpn_DBhead_polyLR.yaml` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/hubserving/readme.md:19 — deploy/hubserving/readme.md links to `../../deploy/pdserving/README_CN.md`, but `deploy/pdserving/README_CN.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/hubserving/readme.md:19 — deploy/hubserving/readme.md names `./deploy/pdserving`, but no file or folder `deploy/pdserving` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift deploy/hubserving/readme_en.md:18 — deploy/hubserving/readme_en.md links to `../../deploy/pdserving/README.md`, but `deploy/pdserving/README.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • + 15 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate api_sdk/go/resource.go:216 — `resp.StatusCode >= 200 && resp.StatusCode < 300` appears character-identically in 2 files — api_sdk/go/resource.go, api_sdk/go/transport.go. 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 paddleocr-js/packages/core/src/models/common.ts:34 — `Boolean(value) && typeof value === "object" && !Array.isArray(value)` appears character-identically in 2 files — paddleocr-js/packages/core/src/models/common.ts, paddleocr-js/packages/core/src/pipelines/ocr/config.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 paddleocr-js/packages/core/src/platform/browser.ts:82 — `typeof cv.Mat === "function" && source instanceof cv.Mat` appears character-identically in 2 files — paddleocr-js/packages/core/src/platform/browser.ts, paddleocr-js/packages/core/src/platform/worker.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 api_sdk/typescript/src/client.ts:365 — `typeof value === "object" && value !== null` appears character-identically in 2 files — api_sdk/typescript/src/client.ts, api_sdk/typescript/src/internal/poller.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 ppocr/modeling/heads/rec_ppformulanet_head.py:894 — `"cache_position" in model_kwargs and model_kwargs["cache_position"] is not None` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 ppocr/data/imaug/make_border_map.py:53 — `"epoch" in data and hasattr(self, "_base_shrink_ratio")` appears character-identically in 2 files — ppocr/data/imaug/make_border_map.py, ppocr/data/imaug/make_shrink_map.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 ppocr/modeling/heads/rec_ppformulanet_head.py:1033 — `( isinstance(decoder_start_token_id, int) and (decoder_input_ids[:, 0] != decoder_start_token_id).all().item() ) or ( isinstance(decoder_sta…` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 REDACTED:362 — `H == self.img_size[0] and W == self.img_size[1]` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate ppocr/modeling/heads/rec_ppformulanet_head.py:473 — `attention_mask is not None and 0 in attention_mask` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 ppocr/modeling/heads/rec_ppformulanet_head.py:332 — `attention_mask is not None and len(attention_mask.shape) == 4` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 paddleocr/_api_client/async_client.py:66 — `base_url or os.environ.get("PADDLEOCR_BASE_URL") or DEFAULT_BASE_URL` appears character-identically in 2 files — paddleocr/_api_client/async_client.py, paddleocr/_api_client/client.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 paddleocr/_pipelines/ocr.py:116 — `det_model_name is None or rec_model_name is None` appears character-identically in 2 files — paddleocr/_pipelines/ocr.py, paddleocr/_pipelines/pp_structurev3.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 ppocr/modeling/heads/rec_ppformulanet_head.py:500 — `encoder_hidden_states is not None and encoder_attention_mask is not None` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 ppocr/modeling/heads/rec_ppformulanet_head.py:1170 — `eos_token is not None and ( paddle.cumsum((input_ids == eos_token).cast(paddle.int64), 1)[:, -1] >= 1 ).all()` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 tools/eval.py:99 — `extra_input or config["Architecture"]["Models"][key]["algorithm"]` appears character-identically in 2 files — tools/eval.py, tools/program.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 ppstructure/kie/tools/eval_with_label_end2end.py:152 — `gt_match[index_gt] == False and dt_match[index_dt] == False` appears character-identically in 2 files — ppstructure/kie/tools/eval_with_label_end2end.py, tools/end2end/eval_end2end.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 deploy/hubserving/kie_ser/module.py:110 — `images != [] and isinstance(images, list) and paths == []` appears character-identically in 9 files — deploy/hubserving/kie_ser/module.py, deploy/hubserving/kie_ser_re/module.py, deploy/hubserving/ocr_cls/module.py, deploy/hubserving/ocr_det/module.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 deploy/hubserving/kie_ser/module.py:112 — `images == [] and isinstance(paths, list) and paths != []` appears character-identically in 9 files — deploy/hubserving/kie_ser/module.py, deploy/hubserving/kie_ser_re/module.py, deploy/hubserving/ocr_cls/module.py, deploy/hubserving/ocr_det/module.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 ppocr/modeling/heads/rec_ppformulanet_head.py:445 — `input_ids is not None and inputs_embeds is not None` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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 REDACTED:2021 — `is_last_special is None or is_last_special == is_special` appears character-identically in 2 files — REDACTED, ppocr/postprocess/rec_postprocess.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 REDACTED:592 — `isinstance(m, nn.Linear) and m.bias is not None` appears character-identically in 8 files — REDACTED, ppocr/modeling/backbones/rec_svtrv2.py, REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate paddleocr/_pipelines/ocr.py:123 — `lang is not None or ocr_version is not None` appears character-identically in 2 files — paddleocr/_pipelines/ocr.py, paddleocr/_pipelines/pp_structurev3.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 ppstructure/table/predict_structure.py:191 — `len(bbox_list) > 0 and len(bbox_list[0]) == 4` appears character-identically in 2 files — ppstructure/table/predict_structure.py, tools/infer_table.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 ppocr/data/imaug/pg_process.py:520 — `min(min_area_quad_h, min_area_quad_w) < self.min_text_size * ds_ratio or min(min_area_quad_h, min_area_quad_w) > self.max_text_size * ds_rat…` appears character-identically in 2 files — ppocr/data/imaug/pg_process.py, ppocr/data/imaug/sast_process.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 ppocr/modeling/heads/rec_ppformulanet_head.py:978 — `model_kwargs is not None and "decoder_input_ids" in model_kwargs` appears character-identically in 2 files — ppocr/modeling/heads/rec_ppformulanet_head.py, ppocr/modeling/heads/rec_unimernet_head.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.
D31 · IaC & Container Security · Low IaC · ×18
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
X4 · Structured logging · Interpolated log message defeats structured logging · ×6
  • Interpolated log message defeats structured logging paddleocr/_cli.py:204 — `error` at line 204 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging paddleocr/_cli.py:209 — `info` at line 209 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging paddleocr/_cli.py:213 — `info` at line 213 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging paddleocr/_cli.py:215 — `info` at line 215 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/infer/predict_system.py:73 — `debug` at line 73 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging tools/infer/predict_system.py:140 — `debug` at line 140 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×6
  • Silent fallback default on parse failure deploy/ios_demo/scripts/extract_xcresult_attachments.py:164 — `_attachments_from_activities` returns `[]` when `json.JSONDecodeError` 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.
  • Silent fallback default on parse failure deploy/ios_demo/scripts/generate_benchmark_report.py:79 — `_fmt_duration_ms` returns `'—'` when `(TypeError, ValueError)` 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.
  • Silent fallback default on parse failure deploy/ios_demo/scripts/generate_benchmark_report.py:89 — `_fmt_ms` returns `'—'` when `(TypeError, ValueError)` 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.
  • Silent fallback default on parse failure deploy/ios_demo/scripts/generate_benchmark_report.py:411 — `_fmt_metric_number` returns `'—'` when `(TypeError, ValueError)` 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.
  • Silent fallback default on parse failure paddleocr/_doc2md/converters/docx.py:267 — `_detect_heading_level` returns `1` when `ValueError` 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.
  • Silent fallback default on parse failure ppstructure/table/tablepyxl/style.py:340 — `get_number_format` returns `'#,##0.##'` when `ValueError` 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×5
  • Silent fallback default in catch benchmark/PaddleOCR_DBNet/utils/cal_recall/script.py:120 — `get_intersection_over_union` (in `evaluate_method`) swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
  • Silent fallback default in catch REDACTED:153 — `_do_check` (in `_check_vlm_ready`) swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
  • Silent fallback default in catch paddleocr/_doc2md/converters/docx.py:1135 — `_extract_chart_tables` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
  • Silent fallback default in catch paddleocr/_doc2md/converters/docx.py:1169 — `_extract_textbox_paragraphs` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
  • Silent fallback default in catch api_sdk/typescript/src/client.ts:391 — `resourceExtension` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
D34 · Knowledge Freshness · Most significant orphaned file · ×3
  • Most significant orphaned file ppocr/modeling/heads/rec_unimernet_head.py:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
  • Most significant orphaned file REDACTED:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
  • Most significant orphaned file ppocr/postprocess/rec_postprocess.py:1 — One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
D10 · Test Quality · Mock-dominated test · ×2
  • Mock-dominated test: predicts multiple sources when input is an array paddleocr-js/packages/core/test/worker-backed.test.ts:143 — This test sets up 3 test doubles (for example `vi .fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: allows per-predict batch size override on the recognition model paddleocr-js/packages/core/test/rec-model.test.ts:210 — This test sets up 7 test doubles (for example `vi.fn`) against 3 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Low vulnerability · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 1 significant file(s) lose their only recent owner: paddleocr/_doc2md/converters/docx.py. Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (3 single-owned of 432 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 432 of the 675 production source files in this repository met that bar). They are anonymized user #2 (1 file(s)), anonymized user #3 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: paddleocr/_pipelines/base.py, ppocr/data/latexocr_dataset.py.
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 13 project(s) overshoot their size bounds, lowering Project Cohesion to 8.5/10. The most over is `(repository root)` (92539 LoC, 1201 module-visible types across 72 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Concentrated knowledge decay · ×1
  • Concentrated knowledge decay — 339 of 434 significant files have no living knowledge, while the repository is still being changed at a low rate (2 commit(s) in the last 90 days) — so this is one repo-wide knowledge-decay state, not 339 separate risks. Counted over 434 of the 675 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. The code moved on without the people who understood these files: document them or schedule a read-through before the next change lands in them.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 5/8 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `deploy/avh`, `deploy/ios_demo`, `mcp_server`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 18780 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~0.2 `!` null assertions per 1k TypeScript source lines — 1 assertion(s) across the 5777 source line(s) of the 47 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: api_sdk/typescript/src/client.ts (1). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
X7 · Silent fallback defaults · Silent fallback default on error · ×1
  • Silent fallback default on error api_sdk/go/resource.go:256 — `safeResourceExtension` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
Minor — 1 finding(s)
D12 · Dependency Hygiene · Outdated · ×1
  • Outdated: onnxruntime-objc — `onnxruntime-objc` is locked at 1.24.3 in deploy/ios_demo/Podfile.lock, but 1.30.0 is the newest release the CocoaPods trunk lists within the same major. A `~>` requirement admits every release below the next major — so `pod update onnxruntime-objc` reaches this one with no change to the Podfile.

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-a7ab6e76f563492ba6cbf739bfb429ae/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a7ab6e76f563492ba6cbf739bfb429ae/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .407artifacts/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-update40artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet . --skip-check-update101artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 3 file(s) — `deploy/ios_demo/PaddleOCRDemo/Engine/OCRParameterResolver.swift`, `deploy/ppocr-android/app/src/main/java/com/paddle/ocr/demo/ui/viewmodel/OCRViewModel.kt`, `paddleocr-js/packages/core/src/runtime/ort.ts` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a1707a-0f09-7fa0-93eb-e8e7a53d353e · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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