Public report of GMD170629/ermao-library, published 17 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 17 November 2026, 22:17 UTC · Survey ID cd_84f55c6ab93449c986facf9d76fbbfc3

GMD170629/ermao-library

Measured 17 November 2026, 22:15 UTC, at code version 21b5715

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

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

A large codebase: 269,158 lines of product code in 26 projects, tests not counted · Estimated rebuild effort: about 2.9 person-years · Weakest lens: Production Readiness, 35.9

Findings by how serious they are

195 critical 1997 serious 115 minor

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

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 22:15 UTC

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

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

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

80of 80 dimensions measured by tools.
2293of 2307 findings point to an exact file and line, so you can open each one in the code. The other 14 concern the repository as a whole, such as missing documentation.
80dimensions across 7 lenses, read from 269,158 lines of product code in 26 projects.
Chapters

Executive summary

GMD170629/ermao-library is rated At risk because critical security findings are open. Its score is held back because 35 passwords or keys sit in the current code and we found no automated security scanning of the code, its secrets or its dependencies. It scores 44.9 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 35.9, is the weakest lens and counts most in the score. The best first step is replacing the 35 exposed passwords or keys and switching the old ones off, worth about 7.8 points. Adding automated security scanning comes next, worth about 4.0 points. Raising Production Readiness to 70 would lift the score to about 52.0.

Seventy pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Thirty-five passwords or keys in the code and 11 in the code's history are open to anyone who can read the repository, and twenty-three known security holes in the packages the code depends on can be used by attackers. Pinning each tool to an exact version, replacing each exposed password or key and updating the vulnerable packages would close these risks. Fixing the weaknesses the scanner points to would fix the 19 security weaknesses in the code, and limiting each secret to its own step would deal with the nine secrets exposed to more of the pipeline than needed. The nine buttons or links with no name need a name, even when they only show an icon.

The product code is 269,158 lines, about €430,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.
Production Readiness 35.9 · counts for 46%Security and Compliance 40.2 · counts for 25%Accessibility 53.3 · counts for 14%Code Health 66.1 · counts for 8%Maturity 66.8 · counts for 4%Architecture 82.5 · counts for 2%Performance 100.0 · counts for 1%

If Production Readiness rose from 35.9 to 70, the lowest score rated Strong, the score would rise from 44.9 to about 52.0.

Code composition: what the lines of code are
Product code 67%Tests 33%
Rebuild cost: about €430,000 · Estimate
Cost to rebuild€140,000 to €710,000, for 2,367 to 7,510 hours of work, about 2.9 person-years for 1 to 6 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 45. 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: 269,158 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 35 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (34), REDACTED.
Raises the score by about 7.8 points · Medium effort · REDACTED Scanning
2
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.
Raises the score by about 4.0 points · Medium effort · Security & performance tooling
3
Resolve the 11 REDACTED finding(s) in Secrets (history) — start with REDACTED (10), REDACTED.
Raises the score by about 3.3 points · Medium effort · Secrets (history)

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 €430,000 to build again, about 2.9 person-years of work. Its weakest lens is Production Readiness, at 35.9 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 35 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 7.8 points for medium effort, because it clears the 35 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.5 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 773,647 lines over the last 90 days, which is about 3,137,568 lines a year. At that pace, the extra work comes to an estimated 299.1 to 1794.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

arch :androidApp :androidApp :archiveCore :archiveCore :androidApp->:archiveCore :chapterCore :chapterCore :androidApp->:chapterCore :mobiCore :mobiCore :androidApp->:mobiCore :pdfiumNative :pdfiumNative :androidApp->:pdfiumNative :shared :shared :androidApp->:shared :mobiCore->:chapterCore :mobiCore->:shared @shuku/reader-core reader-core @shuku/readium-web-poc readium-web-poc @shuku/web web @shuku/web->@shuku/reader-core CLibMobi CLibMobi ErmaoChapterCore ErmaoChapterCore ermao-books-api-python ermao-books-api-python ermao-feedback-receiver ermao-feedback-receiver ermao-mobile ermao-mobile ermao_archive_core ermao_archive_core ermao_archive_jni ermao_archive_jni ermao_chapter_jni ermao_chapter_jni ermao_chapters ermao_chapters ermao_chapters_shared ermao_chapters_shared ermao_chapters_web ermao_chapters_web __more__ +6 more projects

Architecture: which parts of the code depend on which

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

1142 modules, with 1586 dependencies between them. 8 loops run through 20 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1102 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 apps.api-python.app.contracts.diagnostics2 apps.api-python.app.contracts.http3 apps.api-python.app.contracts.publication_metadata4 apps.api-python.app.core.authorization5 apps.api-python.app.core.config6 apps.api-python.app.db.base7 apps.api-python.app.modules.automation.domain.access8 apps.api-python.app.modules.imports.application.readable_resource.ports9 apps.api-python.app.modules.library.application.file_move_plans10 com.ermao.library.features.downloads.model11 com.ermao.library.shared.modules.administrativesettings.domain12 com.ermao.library.shared.modules.downloads.domain13 com.ermao.library.shared.modules.reader.domain14 com.ermao.library.shared.modules.servers.domain15 apps.api-python.app.models.auth16 apps.api-python.app.modules.automation.application.grants17 apps.api-python.app.modules.metadata.infrastructure18 apps.api-python.app.modules.reader.application.v5_library_queries19 com.ermao.library.features.administrativesettings20 com.ermao.library.shared.core.network21 com.ermao.library.shared.modules.audio.domain22 com.ermao.library.shared.modules.auth.domain23 apps.api-python.app.bootstrap24 apps.api-python.app.modules.library.infrastructure25 apps.api-python.app.services26 com.ermao.library.shared.modules.downloads.application27 com.ermao.library.shared.modules.library28 com.ermao.library.shared.modules.shelf.domain29 com.ermao.library.shared.modules.workmanagement.domain30 com.ermao.library.features.content.model31 com.ermao.library.shared.modules.reader.application32 com.ermao.library.shared.modules.workmanagement.application33 com.ermao.library.bootstrap34 com.ermao.library.features.library.ui35 com.ermao.library.features.reader.infrastructure36 com.ermao.library.features.shell37 com.ermao.library.shared.modules.audio.application38 com.ermao.library39 com.ermao.library.shared.bootstrap40 com.ermao.library.features.reader.presentation
1 apps.api-python.app.contracts.diagnostics
2 apps.api-python.app.contracts.http
3 apps.api-python.app.contracts.publication_metadata
4 apps.api-python.app.core.authorization
5 apps.api-python.app.core.config
6 apps.api-python.app.db.base
7 apps.api-python.app.modules.automation.domain.access
8 apps.api-python.app.modules.imports.application.readable_resource.ports
9 apps.api-python.app.modules.library.application.file_move_plans
10 com.ermao.library.features.downloads.model
11 com.ermao.library.shared.modules.administrativesettings.domain
12 com.ermao.library.shared.modules.downloads.domain
13 com.ermao.library.shared.modules.reader.domain
14 com.ermao.library.shared.modules.servers.domain
15 apps.api-python.app.models.auth6
16 apps.api-python.app.modules.automation.application.grants4
17 apps.api-python.app.modules.metadata.infrastructure8
18 apps.api-python.app.modules.reader.application.v5_library_queries1
19 com.ermao.library.features.administrativesettings15
20 com.ermao.library.shared.core.network3
21 com.ermao.library.shared.modules.audio.domain3
22 com.ermao.library.shared.modules.auth.domain3
23 apps.api-python.app.bootstrap17121
24 apps.api-python.app.modules.library.infrastructure5314
25 apps.api-python.app.services171
26 com.ermao.library.shared.modules.downloads.application2813
27 com.ermao.library.shared.modules.library112
28 com.ermao.library.shared.modules.shelf.domain11
29 com.ermao.library.shared.modules.workmanagement.domain11
30 com.ermao.library.features.content.model1
31 com.ermao.library.shared.modules.reader.application24613
32 com.ermao.library.shared.modules.workmanagement.application53
33 com.ermao.library.bootstrap421111
34 com.ermao.library.features.library.ui2512214
35 com.ermao.library.features.reader.infrastructure10343
36 com.ermao.library.features.shell2611442
37 com.ermao.library.shared.modules.audio.application12184
38 com.ermao.library11122
39 com.ermao.library.shared.bootstrap111511
40 com.ermao.library.features.reader.presentation1322111261
Uses a module listed above itPart of a loopThe module itself
1 apps.api-python.app.contracts.diagnostics2 apps.api-python.app.contracts.http3 apps.api-python.app.contracts.publication_metadata4 apps.api-python.app.core.authorization5 apps.api-python.app.core.config6 apps.api-python.app.db.base7 apps.api-python.app.modules.automation.domain.access8 apps.api-python.app.modules.imports.application.readable_resource.ports9 apps.api-python.app.modules.library.application.file_move_plans10 com.ermao.library.features.downloads.model11 com.ermao.library.shared.modules.administrativesettings.domain12 com.ermao.library.shared.modules.downloads.domain13 com.ermao.library.shared.modules.reader.domain14 com.ermao.library.shared.modules.servers.domain15 apps.api-python.app.models.auth16 apps.api-python.app.modules.automation.application.grants17 apps.api-python.app.modules.metadata.infrastructure18 apps.api-python.app.modules.reader.application.v5_library_queries19 com.ermao.library.features.administrativesettings20 com.ermao.library.shared.core.network21 com.ermao.library.shared.modules.audio.domain22 com.ermao.library.shared.modules.auth.domain23 apps.api-python.app.bootstrap24 apps.api-python.app.modules.library.infrastructure25 apps.api-python.app.services26 com.ermao.library.shared.modules.downloads.application27 com.ermao.library.shared.modules.library28 com.ermao.library.shared.modules.shelf.domain29 com.ermao.library.shared.modules.workmanagement.domain30 com.ermao.library.features.content.model31 com.ermao.library.shared.modules.reader.application32 com.ermao.library.shared.modules.workmanagement.application33 com.ermao.library.bootstrap34 com.ermao.library.features.library.ui35 com.ermao.library.features.reader.infrastructure36 com.ermao.library.features.shell37 com.ermao.library.shared.modules.audio.application38 com.ermao.library39 com.ermao.library.shared.bootstrap40 com.ermao.library.features.reader.presentationapps.api-python.app.contracts.diagnostics1apps.api-python.app.contracts.http2apps.api-python.app.contracts.publication_metadata3apps.api-python.app.core.authorization4apps.api-python.app.core.config5apps.api-python.app.db.base6apps.api-python.app.modules.automation.domain.access7apps.api-python.app.modules.imports.application.readable_resource.ports8apps.api-python.app.modules.library.application.file_move_plans9com.ermao.library.features.downloads.model10com.ermao.library.shared.modules.administrativesettings.domain11com.ermao.library.shared.modules.downloads.domain12com.ermao.library.shared.modules.reader.domain13com.ermao.library.shared.modules.servers.domain14apps.api-python.app.models.auth15apps.api-python.app.modules.automation.application.grants16apps.api-python.app.modules.metadata.infrastructure17apps.api-python.app.modules.reader.application.v5_library_queries18com.ermao.library.features.administrativesettings19com.ermao.library.shared.core.network20com.ermao.library.shared.modules.audio.domain21com.ermao.library.shared.modules.auth.domain22apps.api-python.app.bootstrap23apps.api-python.app.modules.library.infrastructure24apps.api-python.app.services25com.ermao.library.shared.modules.downloads.application26com.ermao.library.shared.modules.library27com.ermao.library.shared.modules.shelf.domain28com.ermao.library.shared.modules.workmanagement.domain29com.ermao.library.features.content.model30com.ermao.library.shared.modules.reader.application31com.ermao.library.shared.modules.workmanagement.application32com.ermao.library.bootstrap33com.ermao.library.features.library.ui34com.ermao.library.features.reader.infrastructure35com.ermao.library.features.shell36com.ermao.library.shared.modules.audio.application37com.ermao.library38com.ermao.library.shared.bootstrap39com.ermao.library.features.reader.presentation406481153331712153141712813112111112461353421111251221410343261144212184111221115111322111261+1102 more modules (most-connected shown)

At a glance — Code Health · 66.1 · Adequate · gated by D2 ·

At a glance — Architecture · 82.5 · Strong ·

At a glance — Maturity · 66.8 · Adequate · gated by M2 ·

At a glance — Readiness · 35.9 · Weak · gated by D13, P3, P7, P8 ·

At a glance — Security · 40.2 · Checked 5 of 11 · gated by D28, D29, D36 ·

At a glance — Accessibility · 53.3 · Adequate · gated by AC4 ·

At a glance — Performance · 100.0 · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection126High / Critical
A07:2025 — Authentication Failures47High / Critical
A03:2025 — Software Supply Chain Failures36High / Critical
A02:2025 — Security Misconfiguration18High / Critical

Roadmap

Top priorities: Resolve the 35 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (34), REDACTED; 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; Resolve the 11 REDACTED finding(s) in Secrets (history) — start with REDACTED (10), REDACTED.

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

Do thisHelpsEffortDimension
Resolve the 35 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (34), REDACTED.+7.8 ptsMediumREDACTED Scanning
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.+4.0 ptsMediumSecurity & performance tooling
Resolve the 11 REDACTED finding(s) in Secrets (history) — start with REDACTED (10), REDACTED.+3.3 ptsMediumSecrets (history)
Resolve the 19 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (13), REDACTED (3), REDACTED (2).+2.2 ptsMediumDependency Vulnerabilities
Set connect and read timeouts on every client (`RestTemplateBuilder.connectTimeout/readTimeout`, WebClient `responseTimeout`, `HttpRequest.Builder.timeout`, `HttpURLConnection.setReadTimeout`, Feign `connectTimeout`/`readTimeout` in configuration), and wrap calls to dependencies in resilience4j `@Retry`/`@CircuitBreaker`/`@TimeLimiter` (or Spring Retry).+2.1 ptsMediumOutbound HTTP resilience
Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema.+2.1 ptsMediumSchema migrations
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+1.9 ptsMediumKeyboard semantics
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with REDACTED.+0.9 ptsLowADR Quality

File quality

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

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED0.6SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.3SlopREDACTED Scanning: Leaked secret: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.4SlopIaC & Container Security: High IaC: REDACTED
REDACTED4.4MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.5MixedCyclomatic Complexity: organize_service.bangumi_candidates (cyclomatic 26)
REDACTED4.6MixedSecrets (history): REDACTED: REDACTED
REDACTED4.6MixedSecrets (history): REDACTED: REDACTED
apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py4.8MixedCyclomatic Complexity: ProcessReadableResourceImportTask._execute_directory (cyclomatic 73)
REDACTED4.8MixedDependency Vulnerabilities: Critical vulnerability: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): Medium: 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 — 195

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

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

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

Could not be resolved — 18

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

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 80 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

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

What we checked — 80 dimensions across the health lenses
D1D2D3D4D5D6D10D13D14D15D17D19D20D21D23D24D26D28D29D30D31D34D35D36D43D44AC1AC2AC3AC4AC5AC6AX10AX2AX3AX4AX5AX6AX8AX9M1M2M3M4P1P10P2P3P4P5P6P7P8PF3R1R10R11R2R3R4R6R7R8R9X1X12X13X15X17X2X21X24X25X26X27X28X3X30X4X5

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, 2293 of 2307 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1eb94-77a3-7e42-a9bc-6b3d73e8b59d.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 751 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 534 test source file(s) (.py, .kt, .swift) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. This is OUR limitation, not a defect in the repo — it is excluded from the score.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the its own test command under node's V8 coverage suite in the repository root was NOT MEASURED: the dependency install for the repository root failed in the analyzer sandbox (ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)), so the suite never ran. This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
  • D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — a Gradle build resolved 426 artifact(s) across its subprojects (185 behind a shipped release, reported), but the currency signal was not established over the whole graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares REDACTED, but the licence verdict published here was taken over its 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.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 960 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (packages/reader-core/native/chapters/Package.swift), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D28 Secrets (history) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D28's config-credential rule (WD-SECRET-0002) parses each committed `.json` config as a document and reads credential-named values; `packages/reader-contracts/schemas/reader-safety-policy-v1.schema.json` did not parse (JSON5, a template, several concatenated documents), so a credential bound there is UNMEASURED by that rule. gitleaks still scanned the same files as text.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/bootstrap/MainViewModel.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsRepository.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt`, … (+58 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 15 further occurrence(s) are not listed individually; the score already reflects all 55.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in apps/mobile/mobiCore/src/main/kotlin/com/ermao/library/mobi/infrastructure/MobiReadiumPublicationFactory.kt, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Boot via AndroidApp (apps/mobile/androidApp). the Android app did not build — `./gradlew :androidApp:assembleDebug` exited 1: resolve com.github.marain87:PdfiumAndroid:1.9.8. > Could not get resource 'https://jitpack.io/com/github/marain87/PdfiumAndroid/1.9.8/PdfiumAndroid-1.9.8.pom'. > Could not GET 'ht…; runtime evidence skipped (launch chosen because apps/mobile/androidApp/build.gradle.kts applies the Android application plugin and apps/mobile/gradlew builds it).
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Kotlin, Python, Swift, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's Kotlin, Python, Swift, 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 reads a prose claim (a path, a setting, a variable, a route, a version, a project, an install, a bare project name in a command) only in text identified as English: the cues that tell a claim from an absence, the past, a plan or an example are an English lexicon, and on other text they would let a false claim through. Links, image targets, fenced commands with an explicit path or a package-manager script, and env-fence variables are checked in every language. 'und' is text the identifier could not name (too short, mixed script, no function words).
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 106 further occurrence(s) are not listed individually; the score already reflects all 146.
  • R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 188 further occurrence(s) are not listed individually; the score already reflects all 228.
  • R4 Test Coverage — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 75 further occurrence(s) are not listed individually; the score already reflects all 115.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 84 further occurrence(s) are not listed individually; the score already reflects all 124.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X24 Document value interpolated into markup unescaped — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity4.7 / 10Weak✓ Tool-verified

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

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

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

334 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was reader-shell.ReaderShell at 225. A further 24 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ReaderSessionKt.readerErrorCodeForFailure at 58 — they are counted neither in the figure above nor in this dimension's score. 10 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSession.kt (ReaderSessionKt.readerErrorCodeForFailure at 58), apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderControls.kt (ReaderControlsKt.supportsDeclaredControl at 50), apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/SharedAdministrativeSettingsAdapter.kt (SharedAdministrativeSettingsAdapter.execute at 44), apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsRepository.kt (AdministrativeSettingsRepositoryKt.requiredCapability at 41), apps/mobile/iosApp/ErmaoLibrary/Features/Shell/MainTabView.swift (AdministrativeSettingsRoute.identityKey at 26), and 5 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

reader-shell.ReaderShell (cyclomatic 225)apps/web/features/reader/reader-shell.tsx:250
audio-playback-provider.AudioPlaybackProvider (cyclomatic 201)apps/web/features/audio/audio-playback-provider.tsx:166
app-shell.AppShell (cyclomatic 186)apps/web/components/layout/app-shell.tsx:143
book-detail-page.BookDetailPage (cyclomatic 156)apps/web/features/books/book-detail-page.tsx:189
generate-reader-safety-policy.validate_policy (cyclomatic 130)packages/reader-contracts/generate-reader-safety-policy.py:109

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

What to do

  1. Bring the 6 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with reader-shell.ReaderShell (cyclomatic 225), audio-playback-provider.AudioPlaybackProvider (cyclomatic 201), app-shell.AppShell (cyclomatic 186). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cyclomatic Complexity from 4.7 to about 5.4/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D2 · Cognitive Complexity2.9 / 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 2.9 / 10 · rule-coverage 100% · ceiling Prevented

459 method(s) exceeded the cognitive complexity threshold of 15; the worst was reader-shell.ReaderShell at 309.

reader-safety-policy.rewriteReferences::expandEntity (cognitive 36) · ×2apps/web/features/reader/v3/security/reader-safety-policy.ts:286
book-detail-page.BookDetailPage::invokeSourceNodeAction (cognitive 21) · ×2apps/web/features/books/book-detail-page.tsx:573
shelves-page.ShelvesPage::saveShelf (cognitive 20) · ×2apps/web/features/shelves/shelves-page.tsx:471
reader-shell.ReaderShell (cognitive 309)apps/web/features/reader/reader-shell.tsx:250
shelves-page.ShelvesPage (cognitive 244)apps/web/features/shelves/shelves-page.tsx:76

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

What to do

  1. Bring the 2 bodies over 240 down to 240 or less in Cognitive Complexity — start with reader-shell.ReaderShell (cognitive 309), shelves-page.ShelvesPage (cognitive 244). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 2 together lifts Cognitive Complexity from 2.9 to about 3.3/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.

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

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

208 god class(es) detected.

FileTooLong: presentation/ReaderScreen.kt · ×85apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt
FunctionTooLong: shelves-page.ShelvesPage · ×48apps/web/features/shelves/shelves-page.tsx:76
TooManyMethods: SharedAdministrativeSettingsClient · ×29apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:4
ClassTooLong: WorkDetailView · ×25apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:171
MethodTooLong: AudioPlayerUiKt.AudioNowPlayingScreen · ×21apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:229

What to do

  1. Resolve the 85 FileTooLong finding(s) in God Classes — start with REDACTED (4), ReaderScreen.kt, WorkDetailScreen.kt. — One of this dimension's main actionable groups (85 warning-level).
  2. Resolve the 48 FunctionTooLong finding(s) in God Classes — start with reader-v3-page.tsx (2), pwa-client.tsx (2), shelves-page.tsx. — One of this dimension's main actionable groups (48 warning-level).
  3. Resolve the 29 TooManyMethods finding(s) in God Classes — start with SharedAdministrativeSettingsClient.swift, KtorAdministrativeSettingsRepository.kt, WorkDetailView.swift. — One of this dimension's main actionable groups (29 warning-level).

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

D4 · Code Duplication8.4 / 10Strong✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

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

Duplicated block (6 lines × 2) · ×19apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.py:34
Edited copy of a member (10 corresponding lines) · ×13apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:112
Duplicated block (11 lines × 2) · ×13apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:117
Duplicated block (10 lines × 2) · ×13apps/api-python/app/modules/library/presentation/http.py:1336
Duplicated block (9 lines × 2) · ×13apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:939

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

What to do

  1. Resolve the 19 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with AtomicDownloadFileSink.kt (2), IosComicReaderSession.swift (2), 0012_resource_import_tasks.py. — One of this dimension's main actionable groups (19 warning-level).
  2. Resolve the 13 Edited copy of a member (10 corresponding lines) finding(s) in Code Duplication — start with IosComicNavigatorViewController.swift, AdministrativeSettingsRequests.kt, UserSettingsViews.swift. — One of this dimension's main actionable groups (13 warning-level).
  3. Resolve the 13 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), verify-reader-safety-conformance.py (2), 0009_reader_v5_opaque_progress.py. — One of this dimension's main actionable groups (13 warning-level).

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

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

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

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

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

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

26 production modules (Gradle+npm+Python+SwiftPM+CMake), 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; 5 module(s) off the main sequence, with abstractness counted on 12 of the 26 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: :archiveCore · ×4
Off the main sequence: :shared

What to do

  1. Resolve the 4 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (4 warning-level).

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

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ 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

0 of 149 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D10 · Test Quality10.0 / 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 10.0 / 10 · rule-coverage 100% · ceiling Prevented

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

No assertions: wake lock request rejection never blocks the reader lifecycleapps/web/features/reader/screen-wake-lock.test.ts:40

What to do

  1. Resolve the 1 No assertions finding(s) in Test Quality — start with screen-wake-lock.test.ts. — One of this dimension's main actionable groups (1 warning-level).

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

D13 · REDACTED Scanning0.0 / 10Critical✓ Tool-verified

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

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

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

2 secret(s) detected. 10 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

REDACTED

What to do

  1. Resolve the 35 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (34), REDACTED. — One of this dimension's main actionable groups (35 issue-level).

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

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

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

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

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

0 of 16 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 9 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. 8 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 20 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 REDACTED, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 202 serious findings✓ Tool-verified

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

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

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

Top hotspots: apps/web/features/books/book-detail-page.tsx (31×156=4836); apps/web/features/audio/audio-playback-provider.tsx (17×201=3417); apps/web/features/reader/reader-shell.tsx (15×225=3375) Repeated repair below the complexity floor: apps/api-python/app/db/sqlite.py (7 of 12 changes were fixes); apps/api-python/app/modules/imports/infrastructure/pdf_inspection.py (5 of 9 changes were fixes); apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py (5 of 8 changes were fixes)

Hotspot: apps/web/features/books/book-detail-page.tsx · ×183apps/web/features/books/book-detail-page.tsx:189
Repeated repair: apps/api-python/app/db/sqlite.py · ×19apps/api-python/app/db/sqlite.py:52

What to do

  1. Resolve the 183 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (6), api.ts (2), writes.py (2). — One of this dimension's main actionable groups (183 warning-level).
  2. Resolve the 19 Repeated repair finding(s) in Churn × Complexity Hotspots — start with imported_book_metadata.py (2), sqlite.py, pdf_inspection.py. — One of this dimension's main actionable groups (19 warning-level).

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

D17 · Explicit Debt10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d17_recommendation.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

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

2 of 2 documentation facets pass in full. 44 document(s) read across 18 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

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

No architecture decision records were found.

No ADRs foundREDACTED:7

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with REDACTED. — 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 Consistency7.3 / 10Strong✓ Tool-verified

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

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

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

1 naming inconsistencies among 37 declarations measured against a convention their peers follow.

`DownloadTaskDTO` spells `DTO` where 36 names in the project spell it `Dto`apps/api-python/app/modules/download/application/dto.py:8

What to do

  1. Resolve the 1 `DownloadTaskDTO` spells `DTO` where 36 names in the project spell it… finding(s) in Naming Consistency — start with dto.py. — One of this dimension's main actionable groups (1 recommendation-level).

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

D23 · Boundary Type-Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

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

No domain types leak across context boundaries (2 contexts). Contexts: api-python, feedback-receiver.

✓ On the Gold path — maintain.

Detailed fixes: d23_recommendation.md.

D24 · Comment Value10.0 9.8 / 10Exemplary○ Nothing flagged

What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).

Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.

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

0 of 132 judged comments only repeat the code they sit on (0.0 %). 3 comment(s) in another language or script were not judged.

✓ On the Gold path — maintain.

Detailed fixes: d24_recommendation.md.

D26 · Project Cohesion4.7 / 10Weak✓ Tool-verified

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

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

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

5 of 19 build units (Gradle, Python, SwiftPM, Xcode, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion · ×5apps/api-python/pyproject.toml:1

What to do

  1. Resolve the 5 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with build.gradle.kts (2), pyproject.toml, REDACTED. — One of this dimension's main actionable groups (5 recommendation-level).

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

D28 · Secrets (history)0.0 / 10Critical✓ Tool-verified

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

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

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

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

REDACTED
REDACTED

What to do

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

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

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

126 finding(s): 0 critical, 102 high, 16 medium, 8 low. 70 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 32 file(s) — `apps/mobile/archiveCore/src/main/cpp/archive_jni.c` (line 49, line 55, line 103, …), `apps/mobile/chapterCore/src/main/cpp/chapter_jni.c` (line 140, line 149, line 171, …), `apps/mobile/gradlew` (line 74, line 178), `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift` (lines 84–174, lines 174–178, line 178, …), `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift` (line 393, line 404, line 454, …), … (+27 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 1 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

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

What to do

  1. Resolve the 11 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (7), REDACTED (3), REDACTED. — One of this dimension's main actionable groups (11 issue-level).
  2. Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (9). — One of this dimension's main actionable groups (9 issue-level).
  3. No action in Static Analysis (SAST) — all 70 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 (70 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

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

31 finding(s): 4 critical, 19 high, 7 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 19 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (13), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (19 issue-level).
  2. Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. Resolve the 2 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED, REDACTED. — 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 Security7.6 / 10Adequategated by 4 critical findings✓ 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 7.6 / 10 · rule-coverage 100% · ceiling Documented

18 finding(s): 0 critical, 4 high, 10 medium, 4 low.

REDACTED
REDACTED
REDACTED

What to do

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

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

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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

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

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

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 914 of the 1534 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling9.8 / 10Stronggated by 8 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: schemas.py↔client.ts 79%; source_node_recognition.py↔REDACTED 75%; process_import_task.py↔source_tree_repository.py 73%

Change coupling: process_import_task.py ↔ source_tree_repository.py · ×5apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1
Change-coupling hub: schemas.py → REDACTED, client.ts, metadata-lookup-modal.tsx · ×3apps/api-python/app/modules/library/presentation/schemas.py

What to do

  1. Resolve the 5 Change coupling finding(s) in Change Coupling — start with process_import_task.py (2), ports.py, scan_source_tree.py. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 3 Change-coupling hub finding(s) in Change Coupling — start with schemas.py, source_node_recognition.py, REDACTED. — One of this dimension's main actionable groups (3 warning-level).

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

D36 · Supply-chain Provenance & Signing2.5 / 10Weak✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

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

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

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 7 platform declaration(s) and 42 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.

AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

AC2 · Forms & labels5.5 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×9) — apps/readium-web-poc/src/main.ts:35, apps/readium-web-poc/src/main.ts:43, apps/readium-web-poc/src/main.ts:45, …
  • This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — apps/readium-web-poc/src/main.ts:87
  • This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×20) — apps/web/components/layout/compact-language-switcher.tsx:38, apps/web/components/ui/resource-select.tsx:31, apps/web/features/automation/ui/automation-settings-page.tsx:67, …
  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×2) — apps/web/features/books/metadata-lookup-modal.tsx:328, apps/web/features/library/library-batch-actions.tsx:562
  • This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×4) — apps/web/features/books/ui/book-shelf-dialog.tsx:84, apps/web/features/library/async-filter-value-editor.tsx:63, apps/web/features/library/smart-filter-builder.tsx:146, …
  • A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one. — REDACTED:269
  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×3) — REDACTED:283, REDACTED:284, apps/web/features/organize/classification-management-panel.tsx:162

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure6.4 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. (×6) — apps/readium-web-poc/src/main.ts:30, apps/readium-web-poc/src/main.ts:60, apps/readium-web-poc/src/main.ts:65, …
  • userScalable: false or a maximumScale below 2 makes the framework render a viewport that stops low-vision users zooming to 200%. Remove the zoom restriction from the exported viewport. — apps/web/app/layout.tsx:63

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC4 · Keyboard semantics2.4 / 10Critical✓ Tool-verified

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".

  • A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×3) — apps/web/components/book/book-table.tsx:176, apps/web/features/reader/reader-shell.tsx:816, apps/web/features/reader/reader-shell.tsx:927
  • This <div role="alertdialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — apps/web/components/system/pwa-client.tsx:400
  • This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×3) — apps/web/components/ui/feedback.tsx:118, apps/web/features/settings/center/users-permissions-page.tsx:437, apps/web/features/settings/center/users-permissions-page.tsx:454
  • This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×10) — apps/web/features/books/book-detail-page.tsx:170, apps/web/features/books/kindle-send-modal.tsx:86, apps/web/features/books/metadata-lookup-modal.tsx:314, …
  • This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — apps/web/features/library/library-batch-actions.tsx:366
  • This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — apps/web/features/settings/setup-page.tsx:214
  • This <section role="alertdialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — apps/web/features/settings/setup-page.tsx:234

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety5.1 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. (×4) — apps/web/components/ui/context-action-menu.tsx:148, apps/web/components/ui/feedback.tsx:121, apps/web/features/books/kindle-send-modal.tsx:114, …
  • <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — apps/web/components/ui/multi-value-combobox.tsx:352, apps/web/features/books/ui/book-content-browser.tsx:35, apps/web/features/settings/center/library-import-settings-page.tsx:32
  • <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — REDACTED:280
  • <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×11) — REDACTED:287, apps/web/features/library/library-batch-actions.tsx:449, apps/web/features/library/library-page.tsx:532, …
  • `.mobile-nav button.active` sets color: #ed4d2d on background-color: #fce5de — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — prototypes/feedback-web/prototype.css:12
  • `.editor-tools button:hover` sets color: #d94322 on background-color: #f0e9e4 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — prototypes/feedback-web/prototype.css:14
  • `.editor-switch button.active` sets color: #d94322 on background-color: #fff — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — prototypes/feedback-web/prototype.css:14
  • `.upload-item>img,.upload-file-icon` sets color: #d94322 on background-color: #f4eee9 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from). — prototypes/feedback-web/prototype.css:14
  • `.markdown-input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — prototypes/feedback-web/prototype.css:14
  • `.spinner` moves (`animation: spin .75s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — prototypes/feedback-web/prototype.css:10
  • `.shuku-loading-panel::after` moves (`animation: shuku-loading-spin 0.85s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/web/app/globals.css:604

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AX10 · Code composition6.1 / 10Adequate✓ 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.

AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

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

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

AX6 · Interface segregation9.9 / 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.

  • `ReaderV5Storage` declares 16 required operations: `getClientId`, `getV5Progress`, `putV5Progress`, `putV5ExactAndPending`, `putV5PendingProgress`, `getV5PendingProgress`, `getV5PendingProgressForIdentity`, `listV5PendingProgress`, `deleteV5PendingProgress`, `putV5ExactAndDeletePending`, `getPreference`, `putPreference`, `deletePreference`, `addDiagnostic`, `listDiagnostics`, `clearAll`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/web/lib/reader/v5-storage.ts:229
  • `AdministrativeSettingsRepository` declares 77 abstract methods: `invalidatePendingResponses`, `loadKindleSettings`, `updateKindleEmail`, `listKindleTasks`, `createKindleTask`, `cancelKindleTask`, `retryKindleTask`, `deleteKindleTask`, `loadEmailSettings`, `updateEmailSettings`, `testSmtp`, `listUsers`, `loadUser`, `createUser`, `updateUser`, `setUserStatus`, `resetUserPassword`, `deleteUser`, `loadLibraries`, `createLibrary`, `updateLibrary`, `deleteLibrary`, `loadDirectory`, `loadLibraryScanSettings`, `updateLibraryScanSettings`, `listImportTasks`, `loadImportTask`, `listImportTaskLogs`, `retryImportTask`, `deleteImportTask`, `clearCompletedImportTasks`, `clearImportQueue`, `rescanImportFolders`, `scanDirectory`, `listImportScanJobs`, `loadImportScanJob`, `cancelImportScanJob`, `loadImportPreferences`, `updateImportPreferences`, `listOrganizeJobs`, and 37 more. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/application/AdministrativeSettingsRepository.kt:62
  • `MobileRuntime` declares 16 abstract methods: `observeSession`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTls`, `retry`, `login`, `loginToServer`, `loginToServerAcceptingInsecureTls`, `setupInitialAdmin`, `refreshCurrentSession`, `logout`, `close`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/public.kt:17
  • `MobileRuntimeBridge` declares 16 abstract methods: `observeSession`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTls`, `retry`, `login`, `loginToServer`, `loginToServerAcceptingInsecureTls`, `setupInitialAdmin`, `refreshCurrentSession`, `logout`, `close`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/public.kt:128
  • `WorkManagementRepository` declares 20 abstract methods: `loadBookMenuContext`, `saveBookFields`, `replaceBookTags`, `loadManagementSnapshot`, `saveResourceFields`, `saveSourcePresentation`, `regenerateBookImage`, `deleteResourceSource`, `applyRecognizedFields`, `applyDirectoryMetadata`, `uploadCover`, `regenerateResourceCover`, `rescanBook`, `deleteBook`, `loadMetadataProviders`, `searchMetadata`, `loadKindleSettings`, `sendToKindle`, `setReadingStatus`, `setBookReadingStatus`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/application/WorkManagementRepository.kt:26
  • `BookResourceRepositoryPort` declares 37 protocol members: `refresh_scan_context`, `page_directory_members`, `directory_failure_summary`, `page_ready_directory_cover_candidates`, `save_directory_assets`, `resource_cover_state`, `single_file_fallback_cover`, `resource_local_observations`, `ensure_book`, `get_book_id_for_source_node`, `get_resource_by_source_node`, `get_resource`, `page_book_resources`, `resource_matches_owner`, `create_pending_resource`, `refresh_resource_adapter`, `delete_resource`, `invalidate_asset_for_reimport`, `set_enablement`, `mark_resource_ready`, `set_resource_page_count`, `should_extract_first_page_cover`, `save_asset_local_metadata`, `refresh_resource_local_metadata`, `apply_local_metadata`, `clear_local_cover`, `mark_resource_failed`, `upsert_asset`, `asset_has_processed_version`, `asset_was_imported`, `count_ready_assets`, `refresh_audio_resource_aggregates`, `replace_navigation_units`, `find_outermost_directory_resource`, `delete_library_overlay_rows`, `delete_assets_for_source_nodes`, `reevaluate_ready_after_asset_loss`. Counted over its public methods and properties, once per name — a `typing.Protocol` is satisfied structurally, so every one of them is an operation each implementer must provide and each consumer depends on; `_`-prefixed members, static methods and data attributes are not counted, and an `@overload` family is one operation. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/api-python/app/modules/library/application/source_tree_ports.py:262
  • `MobileRuntimeClient` declares 16 requirements: `observe`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTLS`, `loginToServer`, `loginToServerAcceptingInsecureTLS`, `login`, `setup`, `retry`, `refreshCurrentSession`, `logout`, `close`. Counted over its method requirements (members with no body), once per name; a default supplied by a protocol extension is not counted, because no conformer is forced to write it. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/iosApp/ErmaoLibrary/Application/MobileRuntimeClient.swift:157
  • `AdministrativeSettingsClient` declares 75 requirements: `invalidatePendingResponses`, `loadManagementSummary`, `loadEmailAndKindle`, `saveKindle`, `saveSMTP`, `sendSMTPTest`, `loadKindleTasks`, `cancelKindleTask`, `retryKindleTask`, `deleteKindleTask`, `loadUsers`, `loadUser`, `createUser`, `updateUser`, `setUserEnabled`, `deleteUser`, `resetUserPassword`, `loadUserEditor`, `loadLibrarySources`, `loadLibrarySource`, `createLibrarySource`, `updateLibrarySource`, `deleteLibrarySource`, `rescanLibrarySource`, `loadServerDirectories`, `scanDirectory`, `cancelDirectoryScan`, `loadImportTasks`, `loadImportTaskDetail`, `retryImportTask`, `deleteImportTask`, `clearCompletedImportTasks`, `rescanAllLibrarySources`, `loadImportScans`, `cancelImportScan`, `loadImportPreferences`, `saveImportPreferences`, `loadLibraryScanSettings`, `saveLibraryScanSettings`, `loadOrganizeJobs`, and 35 more. Counted over its method requirements (members with no body), once per name; a default supplied by a protocol extension is not counted, because no conformer is forced to write it. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsClient.swift:3

What to do

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

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

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

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

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

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

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

M1 · Documentation (README)7.3 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

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

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

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

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

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

What to do

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

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

P2 · Observability6.7 / 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 4/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `apps/web`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling0.0 / 10Critical✓ 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 3 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. — REDACTED:4
  • `REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — REDACTED:34

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

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

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

P5 · DR & Backup4.0 / 10Weak✓ Tool-verified

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

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

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
  • No persistence guard on critical data stores — use Docker named volumes (or your orchestrator's persistent-volume equivalent) so the data store can't be wiped by a container recreate (or, in cloud, set purge-protection / soft-delete / prevent_destroy).
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

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.

  • `HttpClient(` 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. (×2) — apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/PlatformHttpClient.android.kt:20, apps/mobile/shared/src/iosMain/kotlin/com/ermao/library/shared/core/network/PlatformHttpClient.ios.kt:32

What to do

  • Set connect and read timeouts on every client (`RestTemplateBuilder.connectTimeout/readTimeout`, WebClient `responseTimeout`, `HttpRequest.Builder.timeout`, `HttpURLConnection.setReadTimeout`, Feign `connectTimeout`/`readTimeout` in configuration), and wrap calls to dependencies in resilience4j `@Retry`/`@CircuitBreaker`/`@TimeLimiter` (or Spring Retry).
P8 · Schema migrations3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

  • This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema. — apps/feedback-receiver/receiver/app.py:67

What to do

  • Turn off SQLAlchemy create_all() in production and let the versioned migrations own the schema.
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

R1 · Type Safety9.1 / 10Exemplary✓ Tool-verified

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

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

R10 · Code Duplication6.6 / 10Adequate✓ Tool-verified

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

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

  • 82 duplicated blocks under apps/web/features/ have copies in at least two of the sibling directories audio, automation, books, dashboard, feedback, import-tasks (+8 more sibling(s) not listed) — 39 of them are reported below, and 43 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 82 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 82 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 82 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — apps/web/features/management/api/events.ts:19
  • 30 duplicated blocks under apps/web/ have copies in at least two of the sibling directories components, features, i18n, lib, scripts — 12 of them are reported below, and 18 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 30 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — apps/web/components/directory/target-directory-picker.tsx:184
  • apps/web/components/ui/combobox.tsx:63 · apps/web/components/ui/select.tsx:114 — the two spans are one implementation copied and then locally edited — 805 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. — apps/web/components/ui/combobox.tsx:63
  • apps/web/components/ui/combobox.tsx:46 · apps/web/components/ui/multi-value-combobox.tsx:89 — the two spans are one implementation copied and then locally edited — 813 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. — apps/web/components/ui/combobox.tsx:46
  • apps/web/components/directory/target-directory-picker.tsx:184 · apps/web/features/settings/ui/directory-path-picker.tsx:162 — the two spans are one implementation copied and then locally edited — 603 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. — apps/web/components/directory/target-directory-picker.tsx:184
  • apps/web/features/reader/v3/adapters/comic-adapter.ts:215 · apps/web/features/reader/v3/adapters/pdf-adapter.ts:213 — the two spans are one implementation copied and then locally edited — 563 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. — apps/web/features/reader/v3/adapters/comic-adapter.ts:215
  • scripts/python-api-runtime-smoke.mjs:25 · scripts/python-worker-runtime-smoke.mjs:11 — the two spans are one implementation copied and then locally edited — 442 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. — scripts/python-api-runtime-smoke.mjs:25
  • apps/web/components/layout/app-shell.tsx:895 · apps/web/components/layout/app-shell.tsx:1060 — the two spans are one implementation copied and then locally edited — 382 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. — apps/web/components/layout/app-shell.tsx:895
  • REDACTED:24 · scripts/python-api-runtime-smoke.mjs:11 — the two spans are one implementation copied and then locally edited — 395 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. — REDACTED:24
  • apps/web/scripts/build-chapters-wasm.mjs:6 · apps/web/scripts/build-mobi-wasm.mjs:6 — the two spans are one implementation copied and then locally edited — 544 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. — apps/web/scripts/build-chapters-wasm.mjs:6
  • apps/web/components/ui/multi-value-combobox.tsx:92 · apps/web/components/ui/select.tsx:104 — the two spans are one implementation copied and then locally edited — 474 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. — apps/web/components/ui/multi-value-combobox.tsx:92
  • apps/web/features/management/api/events.ts:19 · apps/web/features/organize/api/facets.ts:15 — the two spans are one implementation copied and then locally edited — 385 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. — apps/web/features/management/api/events.ts:19
  • apps/web/features/reader/v3/original-publication/mobi-worker-client.ts:10 · apps/web/features/reader/v3/original-publication/text-worker-client.ts:10 — the two spans are one implementation copied and then locally edited — 339 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. — apps/web/features/reader/v3/original-publication/mobi-worker-client.ts:10
  • apps/web/scripts/migrate-i18n-jsx-attributes.mjs:14 · apps/web/scripts/migrate-i18n-jsx-expressions.mjs:20 — 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. — apps/web/scripts/migrate-i18n-jsx-attributes.mjs:14
  • apps/web/features/library/async-filter-value-editor.tsx:27 · apps/web/features/library/ui/library-tag-input.tsx:29 — the two spans are one implementation copied and then locally edited — 222 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. — apps/web/features/library/async-filter-value-editor.tsx:27
  • apps/web/features/audio/audio-playback-provider.tsx:588 · apps/web/features/reader/v3/reader-v3-page.tsx:407 — the two spans are one implementation copied and then locally edited — 183 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. — apps/web/features/audio/audio-playback-provider.tsx:588
  • apps/web/features/reader/reader-shell.tsx:1117 · apps/web/features/reader/reader-shell.tsx:1180 — the two spans are one implementation copied and then locally edited — 188 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. — apps/web/features/reader/reader-shell.tsx:1117
  • apps/web/features/organize/classification-management-panel.tsx:169 · apps/web/features/organize/organize-page.tsx:415 — 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. — apps/web/features/organize/classification-management-panel.tsx:169
  • apps/web/features/reader/v3/adapters/readium-publication.ts:377 · apps/web/features/reader/v3/adapters/readium-publication.ts:401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — apps/web/features/reader/v3/adapters/readium-publication.ts:377
  • apps/web/lib/pwa/frontend-resource-update.ts:43 · apps/web/lib/pwa/frontend-resource-update.ts:136 — the two spans are one implementation copied and then locally edited — 147 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. — apps/web/lib/pwa/frontend-resource-update.ts:43
  • apps/web/scripts/build-mobi-wasm.mjs:23 · apps/web/scripts/verify-mobi-wasm.mjs:9 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — apps/web/scripts/build-mobi-wasm.mjs:23
  • apps/web/scripts/verify-chapters-wasm.mjs:15 · apps/web/scripts/verify-mobi-wasm.mjs:9 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — apps/web/scripts/verify-chapters-wasm.mjs:15
  • apps/web/features/kindle/kindle-send-queue-page.tsx:127 · apps/web/features/organize/organize-page.tsx:259 — 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. — apps/web/features/kindle/kindle-send-queue-page.tsx:127
  • apps/web/components/layout/app-shell.tsx:395 · apps/web/features/reader/v3/use-reader-pwa-surface.ts:19 — 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. — apps/web/components/layout/app-shell.tsx:395
  • apps/web/components/ui/combobox.tsx:74 · apps/web/components/ui/multi-value-combobox.tsx:157 · apps/web/components/ui/select.tsx:136 — the 3 copies are spread across 3 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. — apps/web/components/ui/combobox.tsx:74
  • apps/web/features/books/metadata-lookup-modal.tsx:127 · apps/web/features/books/ui/source-node-metadata-dialogs.tsx:107 — the two spans are one implementation copied and then locally edited — 106 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. — apps/web/features/books/metadata-lookup-modal.tsx:127
  • apps/web/features/library/api/bulk-operations.ts:37 · apps/web/features/management/api/events.ts:22 · apps/web/features/organize/api/facets.ts:18 — the 3 copies are spread across 3 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. — apps/web/features/library/api/bulk-operations.ts:37
  • apps/web/features/reader/v3/paged-track/paged-track-controller.ts:505 · apps/web/features/reader/v3/paged-track/paged-track-controller.ts:529 — the two spans are one implementation copied and then locally edited — 96 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. — apps/web/features/reader/v3/paged-track/paged-track-controller.ts:505
  • apps/web/features/books/book-detail-page.tsx:262 · apps/web/features/import-tasks/import-tasks-page.tsx:182 — 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. — apps/web/features/books/book-detail-page.tsx:262
  • apps/web/features/dashboard/dashboard-page.tsx:84 · apps/web/features/library/library-page.tsx:506 — the two spans are one implementation copied and then locally edited — 64 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. — apps/web/features/dashboard/dashboard-page.tsx:84
  • apps/web/features/reader/v3/original-publication/chapter-core.ts:57 · apps/web/features/reader/v3/original-publication/mobi-core.worker.ts:26 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — apps/web/features/reader/v3/original-publication/chapter-core.ts:57
  • apps/web/features/reader/v3/security/epub-archive-safety.ts:26 · apps/web/features/reader/v3/security/epub-archive-safety.ts:42 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — apps/web/features/reader/v3/security/epub-archive-safety.ts:26
  • apps/web/features/settings/settings-page.tsx:140 · apps/web/features/settings/settings-page.tsx:246 — 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. — apps/web/features/settings/settings-page.tsx:140
  • scripts/verify-python-backend-migration.mjs:21 · scripts/verify-python-backend-migration.mjs:37 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/verify-python-backend-migration.mjs:21
  • apps/web/features/import-tasks/api/client.ts:52 · apps/web/features/library/api/filtering.ts:7 — the two spans are one implementation copied and then locally edited — 104 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. — apps/web/features/import-tasks/api/client.ts:52
  • apps/web/features/management/management-logs-page.tsx:317 · apps/web/features/management/management-logs-page.tsx:358 — the two spans are one implementation copied and then locally edited — 219 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. — apps/web/features/management/management-logs-page.tsx:317
  • apps/web/features/audio/api.ts:14 · apps/web/features/books/api/client.ts:17 · apps/web/features/reader/v3/api.ts:103 — the 3 copies are spread across 3 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. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — apps/web/features/audio/api.ts:14
  • apps/web/features/books/book-detail-page.tsx:159 · apps/web/features/books/ui/source-node-metadata-dialogs.tsx:62 — 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. — apps/web/features/books/book-detail-page.tsx:159
  • apps/web/features/dashboard/api/dashboard.ts:30 · apps/web/features/management/api/overview.ts:62 — 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. — apps/web/features/dashboard/api/dashboard.ts:30
  • apps/web/features/reader/v3/original-publication/chapter-core.ts:337 · apps/web/features/reader/v3/original-publication/chapter-core.ts:378 — the two spans are one implementation copied and then locally edited — 128 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. — apps/web/features/reader/v3/original-publication/chapter-core.ts:337

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.
R11 · Import Boundaries7.5 / 10Strong✓ Tool-verified

React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).

Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.

  • apps/web/features/reader/api/client.ts:1 reaches into another package with a relative path (../../../../../packages/reader-contracts/reader-http-error-statuses.json) — import the package by name instead. — apps/web/features/reader/api/client.ts:1
  • apps/web/scripts/generate-i18n-catalog.mjs:8 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead. — apps/web/scripts/generate-i18n-catalog.mjs:8
  • apps/web/scripts/migrate-i18n-jsx-attributes.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead. — apps/web/scripts/migrate-i18n-jsx-attributes.mjs:7
  • apps/web/scripts/migrate-i18n-jsx-expressions.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead. — apps/web/scripts/migrate-i18n-jsx-expressions.mjs:7
  • apps/web/scripts/migrate-i18n-jsx-text.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead. — apps/web/scripts/migrate-i18n-jsx-text.mjs:7
  • apps/web/scripts/prepare-pdfjs-worker.mjs:6 reaches into another package with a relative path (../node_modules/pdfjs-dist/package.json) — import the package by name instead. — apps/web/scripts/prepare-pdfjs-worker.mjs:6
  • apps/web/scripts/prepare-pdfjs-worker.mjs:7 reaches into another package with a relative path (../node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs) — import the package by name instead. — apps/web/scripts/prepare-pdfjs-worker.mjs:7
  • prototypes/feedback-web/generate-icons.mjs:4 reaches into another package with a relative path (../../REDACTED) — import the package by name instead. — prototypes/feedback-web/generate-icons.mjs:4
  • scripts/container_update_browser.mjs:4 reaches into another package with a relative path (../apps/web/e2e/reader-controls.ts) — import the package by name instead. — scripts/container_update_browser.mjs:4
  • scripts/container_update_browser.mjs:4 imports apps/web/e2e/reader-controls.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/container_update_browser.mjs:4
  • scripts/container_update_browser.mjs:5 reaches into another package with a relative path (../REDACTED) — import the package by name instead. — scripts/container_update_browser.mjs:5

What to do

  • Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (10 rows); move the shared test helper into a source directory production code may depend on (1 row).
R2 · Cyclomatic Complexity5.0 / 10Adequate✓ Tool-verified

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

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

  • ShelvesPage has cyclomatic complexity 146 and cognitive complexity 128; 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. — apps/web/features/shelves/shelves-page.tsx:76
  • ReaderShell has cyclomatic complexity 130 and cognitive complexity 126; 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. — apps/web/features/reader/reader-shell.tsx:250
  • UpdateOperations has cyclomatic complexity 93 and cognitive complexity 79; 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. — apps/web/features/updates/ui/update-operations.tsx:40
  • BookDetailPage has cyclomatic complexity 81 and cognitive complexity 73; 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. — apps/web/features/books/book-detail-page.tsx:189
  • evaluateFactCase has cyclomatic complexity 71 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:563
  • readerErrorMessage has cyclomatic complexity 68 and cognitive complexity 67; 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. — apps/web/features/reader/v3/reader-engine-runtime.tsx:76
  • AudioMiniPlayer has cyclomatic complexity 62 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/components/audio/audio-mini-player.tsx:42
  • LibraryPage has cyclomatic complexity 56 and cognitive complexity 54; 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. — apps/web/features/library/library-page.tsx:75
  • fetchReaderBootstrap has cyclomatic complexity 55 and cognitive complexity 51; 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. — apps/web/features/reader/v3/api.ts:255
  • LibraryBatchDialog has cyclomatic complexity 51 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/features/library/library-batch-actions.tsx:144
  • execute has cyclomatic complexity 44 and cognitive complexity 62; 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. — apps/web/features/reader/v3/adapters/pdf-adapter.ts:367
  • ResourceDetailView has cyclomatic complexity 44 and cognitive complexity 42; 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. — apps/web/features/books/ui/resource-detail-view.tsx:75
  • renderPage has cyclomatic complexity 40 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 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. — apps/web/features/reader/v3/adapters/pdf-adapter.ts:692
  • AppShell has cyclomatic complexity 39 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/components/layout/app-shell.tsx:143
  • openEpub has cyclomatic complexity 38 and cognitive complexity 63; 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. — apps/web/features/reader/v3/adapters/readium-publication.ts:310
  • normalizeAudioBootstrap has cyclomatic complexity 38 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/features/audio/api.ts:103
  • execute has cyclomatic complexity 37 and cognitive complexity 48; 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. — apps/web/features/reader/v3/adapters/comic-adapter.ts:317
  • (anonymous) has cyclomatic complexity 36 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — prototypes/feedback-web/prototype.js:335
  • execute has cyclomatic complexity 33 and cognitive complexity 48; 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. — apps/web/features/reader/v3/adapters/readium-adapter.ts:549
  • openElement has cyclomatic complexity 33 and cognitive complexity 41; 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. — apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:305
  • validateReleaseAssets has cyclomatic complexity 33 and cognitive complexity 38; 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. — scripts/validate-release-assets.mjs:9
  • (anonymous) has cyclomatic complexity 31 and cognitive complexity 38; 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. — apps/web/e2e/release-live.spec.ts:657
  • materializeFb2Chapter has cyclomatic complexity 30 and cognitive complexity 51; 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. — apps/web/features/reader/v3/original-publication/text-publication.worker.ts:108
  • validateRequest has cyclomatic complexity 30 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:29
  • readerSessionReducer has cyclomatic complexity 29 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — packages/reader-core/src/session.ts:96
  • BookContentBrowser has cyclomatic complexity 29 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/features/books/ui/book-content-browser.tsx:75
  • invoke has cyclomatic complexity 27 and cognitive complexity 38; 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. — apps/web/features/books/ui/book-action-controller.tsx:109
  • (anonymous) has cyclomatic complexity 27 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/features/audio/audio-playback-provider.tsx:400
  • namespacesForElement 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. — apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:180
  • (anonymous) has cyclomatic complexity 25 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/e2e/automation-settings.spec.ts:27
  • startFixture has cyclomatic complexity 25 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/e2e/release-live.spec.ts:216
  • TargetDirectoryPicker 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. — apps/web/components/directory/target-directory-picker.tsx:57
  • DirectoryPathPicker has cyclomatic complexity 25 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/features/settings/ui/directory-path-picker.tsx:13
  • MetadataLookupModal has cyclomatic complexity 25 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/features/books/metadata-lookup-modal.tsx:92
  • ReaderEngineRuntime has cyclomatic complexity 25 and cognitive complexity 18; 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. — apps/web/features/reader/v3/reader-engine-runtime.tsx:156
  • dependencyAssets has cyclomatic complexity 25 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/validate-app-packages.mjs:55
  • translateDomNode has cyclomatic complexity 24 and cognitive complexity 50; 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. — apps/web/i18n/provider.tsx:70
  • (anonymous) has cyclomatic complexity 24 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — apps/web/features/audio/audio-playback-provider.tsx:337
  • (anonymous) has cyclomatic complexity 24 and cognitive complexity 28; 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. — apps/web/e2e/release-live.spec.ts:903
  • typeExpression has cyclomatic complexity 24 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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. — apps/web/scripts/generate-reader-api.mjs:48
R3 · Large Files6.8 / 10Adequate✓ 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.

  • apps/web/features/reader/reader-shell.tsx has 1454 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/reader-shell.tsx:1
  • apps/web/features/audio/audio-playback-provider.tsx has 1088 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/audio/audio-playback-provider.tsx:1
  • apps/web/components/layout/app-shell.tsx has 1059 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/components/layout/app-shell.tsx:1
  • apps/web/features/shelves/shelves-page.tsx has 1047 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/shelves/shelves-page.tsx:1
  • apps/web/features/reader/v3/adapters/pdf-adapter.ts has 1044 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/adapters/pdf-adapter.ts:1
  • REDACTED has 872 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • apps/web/features/reader/v3/adapters/readium-adapter.ts has 839 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/adapters/readium-adapter.ts:1
  • apps/web/features/reader/v3/security/reader-safety-policy.ts has 784 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/security/reader-safety-policy.ts:1
  • apps/web/features/reader/v3/adapters/comic-adapter.ts has 758 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/adapters/comic-adapter.ts:1
  • apps/web/features/books/book-detail-page.tsx has 753 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/books/book-detail-page.tsx:1
  • apps/web/features/books/api/client.ts has 700 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/books/api/client.ts:1
  • apps/web/features/library/library-page.tsx has 682 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/library/library-page.tsx:1
  • apps/web/features/settings/settings-page.tsx has 631 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/settings/settings-page.tsx:1
  • apps/web/features/reader/v3/reader-engine-runtime.tsx has 629 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/reader-engine-runtime.tsx:1
  • apps/web/features/reader/v3/adapters/readium-publication.ts has 581 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/adapters/readium-publication.ts:1
  • apps/web/components/system/pwa-client.tsx has 580 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/components/system/pwa-client.tsx:1
  • apps/web/features/reader/v3/reader-v3-page.tsx 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. — apps/web/features/reader/v3/reader-v3-page.tsx:1
  • apps/web/features/library/library-batch-actions.tsx has 555 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/library/library-batch-actions.tsx:1
  • apps/web/features/reader/v3/paged-track/paged-track-controller.ts has 541 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/paged-track/paged-track-controller.ts:1
  • apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts has 497 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:1
  • apps/web/features/books/metadata-lookup-modal.tsx has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/books/metadata-lookup-modal.tsx:1
  • apps/web/features/settings/center/users-permissions-page.tsx has 446 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/settings/center/users-permissions-page.tsx:1
  • apps/web/lib/reader/v5-sync-coordinator.ts has 445 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/lib/reader/v5-sync-coordinator.ts:1
  • apps/web/features/reader/v3/api.ts has 433 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/api.ts:1
  • apps/readium-web-poc/src/main.ts has 432 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/readium-web-poc/src/main.ts:1
  • apps/web/components/audio/audio-mini-player.tsx has 427 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/components/audio/audio-mini-player.tsx:1
  • apps/web/features/reader/v3/adapters/comic-track.ts has 414 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/reader/v3/adapters/comic-track.ts:1
  • apps/web/features/organize/organize-page.tsx has 412 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — apps/web/features/organize/organize-page.tsx:1

What to do

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

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

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

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — apps/web/features/reader/reader-shell.tsx:1, apps/web/components/layout/app-shell.tsx:1, apps/web/features/shelves/shelves-page.tsx:1, …

What to do

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

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

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

R7 · Dead Code8.3 / 10Strong✓ Tool-verified

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

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

  • Unreachable from the 101 application, 22 tooling and 171 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (101 application, 22 tooling, 171 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 (×5) — prototypes/feedback-web/prototype.js, apps/web/features/books/application/use-resource-wall-selection.ts, apps/web/components/book/book-card.tsx, …
  • Nothing imports this binding — it is safe to review for removal. (×22) — apps/web/features/books/api/client.ts:255, apps/web/features/books/api/client.ts:483, apps/web/features/books/api/client.ts:672, …
  • Nothing ultimately consumes this binding: its only referrer is the re-export in apps/web/lib/reader/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in apps/web/lib/reader/index.ts in the same commit, or the barrel will import a name that no longer exists. — apps/web/lib/reader/v5-sync-coordinator.ts:484
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×3) — apps/web/features/reader/v3/adapters/readium-adapter.ts:53, apps/web/features/reader/v3/security/reader-safety-policy.ts:466, apps/web/lib/reader/v5-wire.ts:138

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 Hygiene7.0 / 10Strong✓ 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.

  • Imported but not declared in any reachable REDACTED — installs work only by hoisting accident. — scripts/container_update_browser.mjs:6
  • Only test files import it (first: apps/web/e2e/comic-reader.spec.ts:2) — move it to devDependencies. — REDACTED:48

What to do

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

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

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

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.

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.

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

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

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

  • `parseReaderV5Presentation` is exported, takes a document from its caller (line 197) and hands it to `isJsonValue`, which calls itself at line 111 (`isJsonValue`) with a piece of `value` (and at line 112) — and nowhere in `isJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `isJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — apps/web/lib/reader/v5-wire.ts:111
  • `parseShelfView` is exported and takes `value: unknown` from its caller, and it calls itself at line 124 (`parseShelfView`) with a piece of `value` — and nowhere in `parseShelfView` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `parseShelfView` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — apps/web/features/shelves/api/schemas.ts:124
  • `parse` is not private, takes a value from its caller (line 42) and hands it on to `normalizeMap`, which calls itself at line 406 with a piece of `raw` — and nowhere in the walk is a depth or nesting counter compared with a bound, nor is the parser that builds the document given a nesting limit in this file. The walk therefore spends one stack frame (more through a lambda or a stream) per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes; javac turns no recursive call into a loop. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25). org.json, the W3C DOM, dom4j and StAX set no nesting limit of their own, Jackson before 2.15 none and 2.15+ 1,000 — on a cold JVM past the point the walk fails — and a `Map<String, Object>` tree is as deep as whatever built it. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (Exception e)` around the call does not stop it, and the request or the thread dies with it. Thread a depth argument through `normalizeMap` and reject the value past a fixed maximum, configure the parser's nesting limit (`StreamReadConstraints.maxNestingDepth`, SnakeYAML's `setNestingDepthLimit`), or rewrite the descent with an explicit stack. — apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:406
  • `process_metadata_lookup_task` is public, takes a document from its caller (line 709) and hands it to `_parse_tags`, which calls itself at line 196 (`_parse_tags`) with a piece of `value` — and nowhere in `_parse_tags` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_parse_tags` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:196
  • `metadata_candidate_title_values` is public, takes a document from its caller (line 139) and hands it to `_metadata_title_strings`, which calls itself at line 129 (`_metadata_title_strings`) with a piece of `value` (and at line 134) — and nowhere in `_metadata_title_strings` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_metadata_title_strings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:129
  • `ok` is public, takes a document from its caller (line 24) and hands it to `_normalize_timestamps`, which calls itself at line 14 (`_normalize_timestamps`) with a piece of `value` (and at line 18) — and nowhere in `_normalize_timestamps` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_timestamps` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — apps/api-python/app/schemas/responses.py:14
  • `xml_chapter_events` is public and takes `root: ElementTree.Element` from its caller, and it calls itself at line 90 (`xml_chapter_events`) with a piece of `root` — and nowhere in `xml_chapter_events` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `xml_chapter_events` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:90

What to do

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

Other · Code Health — Whether functions that make a cancellable request accept or pass on an AbortSignal or the coroutine's cancellation (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 53/68 functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http; Ktor, OkHttp newCall, URL streams) accept an AbortSignal or the coroutine's cancellation or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` () and hand it to the request; in a Kotlin suspend function, make the request with a call that suspends — Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` that cancels the `Call` — not a blocking `execute()`: `withContext(Dispatchers.IO)` moves the call off the caller's thread but does not make it cancellable; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `writeShelf` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/shelves/api/client.ts:76
  • `deleteShelfById` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/shelves/api/client.ts:92
  • `runBackupAction` holds an AbortSignal but calls `loadBackups(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `loadBackups(…, { signal })`. — apps/web/features/settings/settings-page.tsx:263
  • `loadImportPreferenceSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/settings/api/import-preferences-client.ts:22
  • `saveReaderBookmarks` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/reader/v3/api.ts:448
  • `loadRuntime` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/reader/v3/original-publication/mobi-core.worker.ts:114
  • `saveOrder` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/organize/metadata-providers-panel.tsx:108
  • `updateProvider` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/organize/metadata-providers-panel.tsx:131
  • `fetchManagementEvents` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/management/api/events.ts:81
  • `fetchManagementEventDetail` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/management/api/events.ts:100
  • `downloadManagementLogFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/management/api/events.ts:111
  • `postJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/library/api/bulk-operations.ts:111
  • `updateBulkBookCovers` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/library/api/bulk-operations.ts:195
  • `postUploadedFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/features/library/api/save-uploaded-files.ts:68
  • `loadInitialState` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — apps/web/components/directory/target-directory-picker.tsx:120

What to do

  • Thread an AbortSignal or the coroutine's cancellation through functions that make requests, so the work stops when its caller gives up.
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.

X24 · Document value interpolated into markup unescaped7.5 / 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.

  • `value` 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 `value` at this site, or validate it against the shape the position accepts before interpolating it. — REDACTED:209
  • `basePathFetchBridge` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — apps/web/app/layout.tsx:80

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 an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. 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.

X3 · Exception handling6.9 / 10Adequate✓ Tool-verified

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×24) — apps/web/lib/audio-device-preferences.ts:41, apps/web/lib/auth-session.ts:40, apps/web/lib/server-exceptions.ts:90, …
  • `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. (×16) — apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:74, apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:87, apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:153, …

What to do

  • Swallowed exception (empty catch)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

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

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

X4 · Structured logging10.0 / 10Exemplary○ Nothing flagged

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

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

X5 · Nullable reference types10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether Kotlin's null safety is not undermined by not-null assertions — `String` cannot hold null and `String?` must be checked before use in every Kotlin module, and each `!!` is a run-time `NullPointerException` the author has told the compiler cannot happen.

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

WCAG coverage — what static analysis assessed

Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

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 Health66.1Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture82.5StrongSolid.
Maturity66.8Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness35.9Weak — gated by D13, P3, P7, P8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security40.2Checked 5 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility53.3Adequate — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance100.0ExemplaryStrongest area.
Unscored — 3 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 — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 4 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 6 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 43 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.

  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the Android app did not build — `./gradlew :androidApp:assembleDebug` exited 1: resolve com.github.marain87:PdfiumAndroid:1.9.8. > Could not get resource 'https://jitpack.io/com/github/marain87/PdfiumAndroid/1.9.8/PdfiumAndroid-1.9.8.pom'. > Could not GET 'ht…; runtime evidence skipped (launch chosen because apps/mobile/androidApp/build.gradle.kts applies the Android application plugin and apps/mobile/gradlew builds it) This is a statement about this run, not a statement about your application: nothing here says the app is inaccessible, only that it was never run.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
  • D12 Dependency Hygiene — Not scored — a Gradle build resolved 426 artifact(s) across its subprojects (185 behind a shipped release, reported), but the currency signal was not established over the whole graph, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D16 Bus Factor — single-contributor repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 reads resolved call sites in the languages it reads only — this repository's production source is .c, .cc, .java, .kt, .swift, .ts, .tsx, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — 63 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — JavaScript/TypeScript suite
  • DM1 Domain Modelling — applicable but not scored (5 signals for this style, 3 needed — the count is met but a required primary signal is absent): 68 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 646 value object(s); 12 domain event(s); its 68 aggregate(s) are ORM models only — persistence, not behaviour: a CRUD model, measured, not claimed as DDD; its domain events are published by services or handlers — no domain entity raises one; a Domain/Aggregates/ValueObjects layer; 15 repository port(s) loading or saving an aggregate/entity; a domain structure with no aggregate, domain event or strongly-typed id in it: a CRUD / clean-architecture model, measured but not claimed as DDD; a top-level examples/ tree: a library or framework whose examples are its consumers — these types are building blocks, not a domain
  • 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, Scala, Rust and Java, 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'.
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for 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.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 37% of this repository's production lines — python (123,237 lines), swift (37,716 lines), c (26,655 lines), cpp (514 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X18 Disposal-pattern correctness — X18 reached only 37% of this repository's production lines — python (123,237 lines), swift (37,716 lines), c (26,655 lines), cpp (514 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — X29 reached only 37% of this repository's production lines — python (123,237 lines), swift (37,716 lines), c (26,655 lines), cpp (514 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • 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 — 195 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
  • + 45 more in this group — see findings.md.
D13 · REDACTED Scanning · Leaked secret · ×35
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 10 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · High CVE · ×19
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×11
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <button> with no accessible text · ×9
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:35 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:43 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:45 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:46 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:48 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:49 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:80 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:83 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
  • <button> with no accessible text apps/readium-web-poc/src/main.ts:88 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <input> without a programmatic label · ×5
  • <input> without a programmatic label apps/web/features/books/metadata-lookup-modal.tsx:328 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label REDACTED:283 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label REDACTED:284 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label apps/web/features/library/library-batch-actions.tsx:562 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label apps/web/features/organize/classification-management-panel.tsx:162 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC4 · Keyboard semantics · Click handler on a non-interactive <div> · ×3
  • Click handler on a non-interactive <div> apps/web/components/book/book-table.tsx:176 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
  • Click handler on a non-interactive <div> apps/web/features/reader/reader-shell.tsx:816 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
  • Click handler on a non-interactive <div> apps/web/features/reader/reader-shell.tsx:927 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×2
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <textarea> without a programmatic label · ×1
  • <textarea> without a programmatic label apps/readium-web-poc/src/main.ts:87 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure · Viewport restricts zoom · ×1
  • Viewport restricts zoom apps/web/app/layout.tsx:63 — userScalable: false or a maximumScale below 2 makes the framework render a viewport that stops low-vision users zooming to 200%. Remove the zoom restriction from the exported viewport.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
R8 · Dependency Hygiene · Unlisted import '@playwright/test' · ×1
  • Unlisted import '@playwright/test' scripts/container_update_browser.mjs:6 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Serious — 1997 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×183
  • Hotspot: apps/web/features/books/book-detail-page.tsx apps/web/features/books/book-detail-page.tsx:189 — apps/web/features/books/book-detail-page.tsx changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 156 in book-detail-page.BookDetailPage at line 189. 14 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/books/book-detail-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/audio/audio-playback-provider.tsx apps/web/features/audio/audio-playback-provider.tsx:166 — apps/web/features/audio/audio-playback-provider.tsx changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 201 in audio-playback-provider.AudioPlaybackProvider at line 166. 8 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/audio/audio-playback-provider.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/reader/reader-shell.tsx apps/web/features/reader/reader-shell.tsx:250 — apps/web/features/reader/reader-shell.tsx changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 225 in reader-shell.ReaderShell at line 250. 5 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/reader/reader-shell.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:575 — apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in ScanLibrarySourceTree._walk at line 575. 13 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:715 — apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 73 in ProcessReadableResourceImportTask._execute_directory at line 715. 11 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/shelves/shelves-page.tsx apps/web/features/shelves/shelves-page.tsx:76 — apps/web/features/shelves/shelves-page.tsx changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 232 in shelves-page.ShelvesPage at line 76. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/shelves/shelves-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:319 — REDACTED changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in metadata_lookup_queue._prepare_candidate_application at line 319. 13 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/components/layout/app-shell.tsx apps/web/components/layout/app-shell.tsx:143 — apps/web/components/layout/app-shell.tsx changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 186 in app-shell.AppShell at line 143. 5 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/components/layout/app-shell.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/books/metadata-lookup-modal.tsx apps/web/features/books/metadata-lookup-modal.tsx:92 — apps/web/features/books/metadata-lookup-modal.tsx changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 97 in metadata-lookup-modal.MetadataLookupModal at line 92. 9 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/books/metadata-lookup-modal.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:218 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in MainShellKt.MainShell at line 218. 7 of those changes were fix/bug commits, and the other 27 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/reader/v3/reader-engine-runtime.tsx apps/web/features/reader/v3/reader-engine-runtime.tsx:156 — apps/web/features/reader/v3/reader-engine-runtime.tsx changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 89 in reader-engine-runtime.ReaderEngineRuntime at line 156. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/reader/v3/reader-engine-runtime.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/worker/main.py apps/api-python/app/worker/main.py:103 — apps/api-python/app/worker/main.py changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in main.main at line 103. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/worker/main.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py:48 — apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in ProviderSourceNodeMetadataRecognition.search at line 48. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/library/library-page.tsx apps/web/features/library/library-page.tsx:75 — apps/web/features/library/library-page.tsx changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in library-page.LibraryPage at line 75. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/library/library-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:214 — REDACTED changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in RegistryResourceAdapterExecutor.parse_file at line 214. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:715 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in WorkDetailScreenKt.WorkDetailActionRow at line 715. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/library/infrastructure/book_list.py apps/api-python/app/modules/library/infrastructure/book_list.py:411 — apps/api-python/app/modules/library/infrastructure/book_list.py changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in book_list.list_books at line 411. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/library/infrastructure/book_list.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:201 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in ReaderScreenKt.ReaderScreen at line 201. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/import-tasks/import-tasks-page.tsx apps/web/features/import-tasks/import-tasks-page.tsx:94 — apps/web/features/import-tasks/import-tasks-page.tsx changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in import-tasks-page.ImportTasksPage at line 94. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/import-tasks/import-tasks-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1400 — apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in SqlAlchemyBookResourceRepository.save_directory_assets at line 1400. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/reader/v3/reader-v3-page.tsx apps/web/features/reader/v3/reader-v3-page.tsx:228 — apps/web/features/reader/v3/reader-v3-page.tsx changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in reader-v3-page.ReaderV5Page at line 228. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/reader/v3/reader-v3-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/settings/settings-page.tsx apps/web/features/settings/settings-page.tsx:54 — apps/web/features/settings/settings-page.tsx changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in settings-page.SettingsPage at line 54. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/settings/settings-page.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/reader/v3/api.ts apps/web/features/reader/v3/api.ts:255 — apps/web/features/reader/v3/api.ts changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in api.fetchReaderBootstrap at line 255. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/reader/v3/api.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/web/features/books/api/client.ts apps/web/features/books/api/client.ts:158 — apps/web/features/books/api/client.ts changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in client.mapBookView at line 158. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/books/api/client.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py:246 — apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in ReadableResourceWorkerProcessor._execute_book at line 246. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 158 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×85
  • FileTooLong: presentation/ReaderScreen.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt — FileTooLong — 2062 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1562 over it, 4.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: ui/WorkDetailScreen.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt — FileTooLong — 2056 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1556 over it, 4.11× 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: versions/0001_library_topology_baseline.py apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py — FileTooLong — 1798 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1298 over it, 3.60× 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: Work/WorkDetailView.swift apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift — FileTooLong — 1737 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: WorkDetailView (171-2120). The bar is 500 significant lines; this is 1237 over it, 3.47× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED apps/api-python/app/modules/library/presentation/http.py — FileTooLong — 1718 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1218 over it, 3.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: persistence/source_tree_repository.py apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py — FileTooLong — 1609 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1109 over it, 3.22× 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: reader/reader-shell.tsx apps/web/features/reader/reader-shell.tsx — FileTooLong — 1302 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: ReaderShell (250-1219). The bar is 500 significant lines; this is 802 over it, 2.60× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: readable_resource/scan_source_tree.py apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py — FileTooLong — 1220 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 720 over it, 2.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: infrastructure/writeback_queue.py apps/api-python/app/modules/metadata/infrastructure/writeback_queue.py — FileTooLong — 1174 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 674 over it, 2.35× 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: presentation/ReaderActivity.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt — FileTooLong — 1145 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: ReaderActivity (105-1414). The bar is 500 significant lines; this is 645 over it, 2.29× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: readable_resource/process_import_task.py apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py — FileTooLong — 1120 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 620 over it, 2.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Reader/IosEpubReaderSession.swift apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift — FileTooLong — 1112 significant lines (blank, comment-only and punctuation-only lines excluded), about 67% of them inside a single declaration: IosReflowableReaderSession (440-1399). The bar is 500 significant lines; this is 612 over it, 2.22× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: application/AndroidAudioPlaybackRuntime.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt — FileTooLong — 1107 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: AndroidAudioPlaybackRuntime (84-1342). The bar is 500 significant lines; this is 607 over it, 2.21× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1015 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 515 over it, 2.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: infrastructure/ReadiumEpubSession.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt — FileTooLong — 993 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: ReadiumEpubSession (104-1081). The bar is 500 significant lines; this is 493 over it, 1.99× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ui/AudioPlayerUi.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt — FileTooLong — 986 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 486 over it, 1.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — 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: audio/audio-playback-provider.tsx apps/web/features/audio/audio-playback-provider.tsx — FileTooLong — 957 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: AudioPlaybackProvider (166-1146). The bar is 500 significant lines; this is 457 over it, 1.91× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: shelves/shelves-page.tsx apps/web/features/shelves/shelves-page.tsx — FileTooLong — 948 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: ShelvesPage (76-1013). The bar is 500 significant lines; this is 448 over it, 1.90× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: reader-contracts/generate-reader-safety-policy.py packages/reader-contracts/generate-reader-safety-policy.py — FileTooLong — 944 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 444 over it, 1.89× 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: application/AudioSessionStateMachine.kt apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt — FileTooLong — 939 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: AudioPlaybackStateMachine (137-1167). The bar is 500 significant lines; this is 439 over it, 1.88× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: layout/app-shell.tsx apps/web/components/layout/app-shell.tsx — FileTooLong — 939 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: AppShell (143-1130). The bar is 500 significant lines; this is 439 over it, 1.88× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: infrastructure/bulk_operations.py apps/api-python/app/modules/library/infrastructure/bulk_operations.py — FileTooLong — 935 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 435 over it, 1.87× 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: Reader/IosComicNavigatorViewController.swift apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift — FileTooLong — 934 significant lines (blank, comment-only and punctuation-only lines excluded), about 67% of them inside a single declaration: IosComicNavigatorViewController (30-859). The bar is 500 significant lines; this is 434 over it, 1.87× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Application/ContentStores.swift apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift — FileTooLong — 911 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 411 over it, 1.82× 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.
  • + 60 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×48
  • FunctionTooLong: shelves-page.ShelvesPage apps/web/features/shelves/shelves-page.tsx:76 — FunctionTooLong — ShelvesPage runs 824 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 724 over it, 8.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: app-shell.AppShell apps/web/components/layout/app-shell.tsx:143 — FunctionTooLong — AppShell runs 823 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 723 over it, 8.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: reader-shell.ReaderShell apps/web/features/reader/reader-shell.tsx:250 — FunctionTooLong — ReaderShell runs 822 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 722 over it, 8.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: audio-playback-provider.AudioPlaybackProvider apps/web/features/audio/audio-playback-provider.tsx:166 — FunctionTooLong — AudioPlaybackProvider runs 812 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 712 over it, 8.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: book-detail-page.BookDetailPage apps/web/features/books/book-detail-page.tsx:189 — FunctionTooLong — BookDetailPage runs 528 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 428 over it, 5.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: library-page.LibraryPage apps/web/features/library/library-page.tsx:75 — FunctionTooLong — LibraryPage runs 508 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 408 over it, 5.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: reader-engine-runtime.ReaderEngineRuntime apps/web/features/reader/v3/reader-engine-runtime.tsx:156 — FunctionTooLong — ReaderEngineRuntime runs 432 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 332 over it, 4.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: settings-page.SettingsPage apps/web/features/settings/settings-page.tsx:54 — FunctionTooLong — SettingsPage runs 395 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 295 over it, 3.95× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: library-batch-actions.LibraryBatchDialog apps/web/features/library/library-batch-actions.tsx:144 — FunctionTooLong — LibraryBatchDialog runs 391 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 291 over it, 3.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: audio-mini-player.AudioMiniPlayer apps/web/components/audio/audio-mini-player.tsx:42 — FunctionTooLong — AudioMiniPlayer runs 375 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 275 over it, 3.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: metadata-lookup-modal.MetadataLookupModal apps/web/features/books/metadata-lookup-modal.tsx:92 — FunctionTooLong — MetadataLookupModal runs 337 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 237 over it, 3.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: users-permissions-page.UsersPermissionsPage apps/web/features/settings/center/users-permissions-page.tsx:88 — FunctionTooLong — UsersPermissionsPage runs 332 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 232 over it, 3.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: reader-v3-page.ReaderV5Page apps/web/features/reader/v3/reader-v3-page.tsx:228 — FunctionTooLong — ReaderV5Page runs 330 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 230 over it, 3.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: multi-value-combobox.MultiValueCombobox apps/web/components/ui/multi-value-combobox.tsx:71 — FunctionTooLong — MultiValueCombobox runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: management-logs-page.ManagementLogsPage apps/web/features/management/management-logs-page.tsx:99 — FunctionTooLong — ManagementLogsPage runs 267 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 167 over it, 2.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: directory-path-picker.DirectoryPathPicker apps/web/features/settings/ui/directory-path-picker.tsx:13 — FunctionTooLong — DirectoryPathPicker runs 255 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: import-tasks-page.ImportTasksPage apps/web/features/import-tasks/import-tasks-page.tsx:94 — FunctionTooLong — ImportTasksPage runs 244 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 144 over it, 2.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: strict-fb2-parser.parseStrictFb2 apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:248 — FunctionTooLong — parseStrictFb2 runs 234 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 134 over it, 2.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: readium-publication.openEpub apps/web/features/reader/v3/adapters/readium-publication.ts:310 — FunctionTooLong — openEpub runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: account-panel.AccountPanel apps/web/features/settings/center/account-panel.tsx:32 — FunctionTooLong — AccountPanel runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: organize-page.OrganizePage apps/web/features/organize/organize-page.tsx:200 — FunctionTooLong — OrganizePage runs 218 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: book-table.BookTable apps/web/components/book/book-table.tsx:25 — FunctionTooLong — BookTable runs 206 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 106 over it, 2.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: pwa-client.PwaClient apps/web/components/system/pwa-client.tsx:79 — FunctionTooLong — PwaClient runs 201 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: target-directory-picker.TargetDirectoryPicker apps/web/components/directory/target-directory-picker.tsx:57 — FunctionTooLong — TargetDirectoryPicker runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: use-reader-session.useReaderSession apps/web/features/reader/v3/use-reader-session.ts:150 — FunctionTooLong — useReaderSession runs 181 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 23 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×40
  • No test reaches this file apps/web/features/reader/reader-shell.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/components/layout/app-shell.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/shelves/shelves-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/reader/v3/adapters/readium-adapter.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/books/book-detail-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/library/library-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/settings-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/reader/v3/reader-engine-runtime.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/components/system/pwa-client.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/scripts/apply-i18n-overrides.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/reader/v3/reader-v3-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/library/library-batch-actions.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/center/users-permissions-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/readium-web-poc/src/main.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/components/audio/audio-mini-player.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/organize/organize-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file prototypes/feedback-web/prototype.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/management/management-logs-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/ui/directory-path-picker.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/import-tasks/import-tasks-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/center/system-health-settings-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file REDACTED:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/center/account-panel.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/components/book/book-table.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file apps/web/features/settings/center/email-settings-page.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • + 15 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×29
  • TooManyMethods: SharedAdministrativeSettingsClient apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:4 — TooManyMethods — 143 methods, declared across 2 files: AdministrativeSettings/SharedAdministrativeSettingsClient.swift (76), AdministrativeSettings/SharedAdministrativeSettingsMapping.swift (67). The bar is 30 methods; this is 113 over it, 4.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. Most of these members implement repository.AdministrativeSettingsClient (75 of 92 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: KtorAdministrativeSettingsRepository apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:24 — TooManyMethods — 104 methods. The bar is 30 methods; this is 74 over it, 3.47× the bar. Most of these members implement application.AdministrativeSettingsRepository (77 of 102 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: WorkDetailView apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:171 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: IosReflowableReaderSession apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:439 — TooManyMethods — 67 methods, declared across 2 files: Reader/IosEpubReaderSession.swift (65), Reader/IosReaderControlAdapters.swift (2). The bar is 30 methods; this is 37 over it, 2.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AudioPlaybackStateMachine apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:137 — TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: IosComicNavigatorViewController apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:29 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AudioPlaybackRuntime apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackRuntime.swift:11 — TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DefaultMobileRuntime apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:36 — TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MainViewModel apps/mobile/androidApp/src/main/kotlin/com/ermao/library/bootstrap/MainViewModel.kt:97 — TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AndroidAudioPlaybackRuntime apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:84 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PdfReaderAdapter apps/web/features/reader/v3/adapters/pdf-adapter.ts:145 — TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ReadiumEpubSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:104 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionStore apps/mobile/iosApp/ErmaoLibrary/Application/SessionStore.swift:4 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SqlAlchemyBookResourceRepository apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:653 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ReadiumPdfSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:61 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: VisualTokenGenerator apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:21 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BookManagementSession apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/application/BookManagementSession.kt:80 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SqlAlchemyLibraryImportTaskQueue apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:71 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ComicReaderAdapter apps/web/features/reader/v3/adapters/comic-adapter.ts:83 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: IosPdfReaderSession apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:4 — TooManyMethods — 37 methods, declared across 2 files: Reader/IosPdfReaderSession.swift (33), Reader/IosReaderControlAdapters.swift (4). The bar is 30 methods; this is 7 over it, 1.23× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ReaderSafetyFacade apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:41 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ReaderActivity apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:105 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DownloadCenterStore apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:5 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SharedContentClient apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:5 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ReadiumComicSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:53 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 4 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×25
  • ClassTooLong: WorkDetailView apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:171 — ClassTooLong — 1482 significant lines (blank, comment-only and punctuation-only lines excluded), 75 methods. The bar is 400 significant lines; this is 1082 over it, 3.71× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ReaderActivity apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:105 — ClassTooLong — 1032 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 632 over it, 2.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AndroidAudioPlaybackRuntime apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:84 — ClassTooLong — 980 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 580 over it, 2.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AudioPlaybackStateMachine apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:137 — ClassTooLong — 825 significant lines (blank, comment-only and punctuation-only lines excluded), 67 methods. The bar is 400 significant lines; this is 425 over it, 2.06× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PdfReaderAdapter apps/web/features/reader/v3/adapters/pdf-adapter.ts:145 — ClassTooLong — 780 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 380 over it, 1.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ReadiumEpubSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:104 — ClassTooLong — 749 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 349 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IosReflowableReaderSession apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:439 — ClassTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded), 67 methods. The bar is 400 significant lines; this is 344 over it, 1.86× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DefaultMobileRuntime apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:36 — ClassTooLong — 671 significant lines (blank, comment-only and punctuation-only lines excluded), 54 methods. The bar is 400 significant lines; this is 271 over it, 1.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IosComicNavigatorViewController apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:29 — ClassTooLong — 629 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 229 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: KtorAdministrativeSettingsRepository apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:24 — ClassTooLong — 618 significant lines (blank, comment-only and punctuation-only lines excluded), 104 methods. The bar is 400 significant lines; this is 218 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AudioPlaybackRuntime apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackRuntime.swift:11 — ClassTooLong — 608 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods. The bar is 400 significant lines; this is 208 over it, 1.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ReadiumWebReaderAdapter apps/web/features/reader/v3/adapters/readium-adapter.ts:137 — ClassTooLong — 589 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 189 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ComicReaderAdapter apps/web/features/reader/v3/adapters/comic-adapter.ts:83 — ClassTooLong — 571 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 171 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MultiDownloadSheet apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:262 — ClassTooLong — 555 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 155 over it, 1.39× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IosEpubArchiveSafetyPreflight apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:69 — ClassTooLong — 521 significant lines (blank, comment-only and punctuation-only lines excluded), 11 methods. The bar is 400 significant lines; this is 121 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ComicNavigatorFragment apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt:96 — ClassTooLong — 480 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 80 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: WorkDetailViewModel apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:225 — ClassTooLong — 472 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 72 over it, 1.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MultiDownloadTreeRow apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:87 — ClassTooLong — 465 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 65 over it, 1.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DownloadCenterStore apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:5 — ClassTooLong — 463 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 63 over it, 1.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ReadiumComicSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:53 — ClassTooLong — 456 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 56 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MainViewModel apps/mobile/androidApp/src/main/kotlin/com/ermao/library/bootstrap/MainViewModel.kt:97 — ClassTooLong — 432 significant lines (blank, comment-only and punctuation-only lines excluded), 50 methods. The bar is 400 significant lines; this is 32 over it, 1.08× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ApiClient apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:87 — ClassTooLong — 430 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 30 over it, 1.08× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MainTabView apps/mobile/iosApp/ErmaoLibrary/Features/Shell/MainTabView.swift:145 — ClassTooLong — 419 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 19 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionStore apps/mobile/iosApp/ErmaoLibrary/Application/SessionStore.swift:4 — ClassTooLong — 402 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. The bar is 400 significant lines; this is 2 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ReadiumPdfSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:61 — ClassTooLong — 402 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 2 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
X3 · Exception handling · Swallowed exception (empty catch) · ×24
  • Swallowed exception (empty catch) apps/web/lib/audio-device-preferences.ts:41 — 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) apps/web/lib/auth-session.ts:40 — 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) apps/web/lib/server-exceptions.ts:90 — 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) apps/web/lib/server-exceptions.ts:99 — 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) apps/web/lib/reader/v5-storage.ts:223 — 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) apps/web/i18n/provider.tsx:61 — 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) apps/web/features/reader/v3/reader-engine-runtime.tsx:417 — 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) apps/web/features/reader/v3/reader-engine-runtime.tsx:438 — 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) apps/web/features/reader/v3/original-publication/indexeddb-publication-storage.ts:105 — 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) apps/web/features/reader/v3/original-publication/indexeddb-publication-storage.ts:119 — 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) apps/web/features/reader/v3/adapters/comic-adapter.ts:121 — 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) apps/web/features/reader/v3/adapters/comic-adapter.ts:754 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) apps/web/features/reader/v3/adapters/pdf-adapter.ts:1092 — 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) apps/web/features/management/management-logs-page.tsx: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) apps/web/features/library/library-page.tsx:414 — 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) apps/web/features/audio/audio-playback-provider.tsx:219 — 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) apps/web/features/audio/audio-playback-provider.tsx:289 — 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) apps/web/features/audio/audio-playback-provider.tsx:854 — 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) apps/web/features/audio/audio-playback-provider.tsx:972 — 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) apps/web/features/audio/audio-playback-provider.tsx:1001 — 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) apps/web/features/audio/audio-playback-provider.tsx:1051 — 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) apps/web/features/audio/audio-playback-provider.tsx:1054 — 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) apps/web/features/audio/audio-playback-provider.tsx:1075 — 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) apps/web/components/system/pwa-client.tsx:140 — 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.
AC2 · Forms & labels · <Select> field component without a label · ×22
  • <Select> field component without a label apps/web/components/layout/compact-language-switcher.tsx:38 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/components/ui/resource-select.tsx:31 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/automation/ui/automation-settings-page.tsx:67 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/automation/ui/automation-settings-page.tsx:137 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/books/book-detail-page.tsx:695 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/books/metadata-lookup-modal.tsx:327 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/books/ui/book-content-browser.tsx:97 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/books/ui/book-shelf-dialog.tsx:84 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/books/ui/source-node-metadata-dialogs.tsx:190 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/import-tasks/import-tasks-page.tsx:242 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/import-tasks/import-tasks-page.tsx:254 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/import-tasks/import-tasks-page.tsx:272 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/library-page.tsx:541 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/library-page.tsx:692 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/smart-filter-builder.tsx:146 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/smart-filter-builder.tsx:200 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/smart-filter-builder.tsx:235 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/library/smart-filter-builder.tsx:244 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/management/management-logs-page.tsx:280 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/management/management-logs-page.tsx:292 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/management/management-logs-page.tsx:294 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Select> field component without a label apps/web/features/organize/classification-management-panel.tsx:174 — This UI-library field component has no label / aria-label / aria-labelledby / id at this call site, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id, even one the component sets on what it renders, names nothing until a label points at it) — so it likely renders an unlabelled control. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
D3 · God Classes · MethodTooLong · ×21
  • MethodTooLong: AudioPlayerUiKt.AudioNowPlayingScreen apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:229 — MethodTooLong — AudioNowPlayingScreen runs 347 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 247 over it, 3.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IosReaderComposition.bootstrap apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:177 — MethodTooLong — bootstrap runs 277 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderScreenKt.ReaderBottomConsole apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:734 — MethodTooLong — ReaderBottomConsole runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderScreenKt.ReaderContentsPanel apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:2116 — MethodTooLong — ReaderContentsPanel runs 153 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WorkDetailScreenKt.WorkDetailBody apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:520 — MethodTooLong — WorkDetailBody runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BookManagementKt.ManagementPresentation apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/BookManagement.kt:328 — MethodTooLong — ManagementPresentation runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: KtorReaderBootstrapGateway.toDomain apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:170 — MethodTooLong — toDomain runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderActivity.openServerReader apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:502 — MethodTooLong — openServerReader runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LoginView.body apps/mobile/iosApp/ErmaoLibrary/Features/Auth/LoginView.swift:42 — MethodTooLong — body runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CentralDirectoryReader.read apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:424 — MethodTooLong — read runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderActivity.createSession apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1065 — MethodTooLong — createSession runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AndroidAudioPlaybackRuntime.launchRemote apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:323 — MethodTooLong — launchRemote runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DownloadResourceRowKt.DownloadResourceRow apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/DownloadResourceRow.kt:49 — MethodTooLong — DownloadResourceRow runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WorkDetailScreenKt.WorkContentBrowser apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1353 — MethodTooLong — WorkContentBrowser runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ComicSpreadTrackDriver.renderSlot apps/web/features/reader/v3/adapters/comic-track.ts:312 — MethodTooLong — renderSlot runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PdfReaderAdapter.renderPage apps/web/features/reader/v3/adapters/pdf-adapter.ts:692 — MethodTooLong — renderPage runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: IosEpubArchiveSafetyPreflight.verifyMetadata apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:91 — MethodTooLong — verifyMetadata runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderScreenKt.ReaderPreferencePanel apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1197 — MethodTooLong — ReaderPreferencePanel runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReaderScreenKt.ReaderNumberSetting apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1794 — MethodTooLong — ReaderNumberSetting runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WorkDetailScreenKt.WorkDetailActionRow apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:715 — MethodTooLong — WorkDetailActionRow runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WorkDetailScreenKt.WorkContentEntryCard apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1531 — MethodTooLong — WorkContentEntryCard runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D15 · Churn × Complexity Hotspots · Repeated repair · ×19
  • Repeated repair: apps/api-python/app/db/sqlite.py apps/api-python/app/db/sqlite.py:52 — apps/api-python/app/db/sqlite.py changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is sqlite._usage_delta at line 52), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(db): let offline index replacement finish under migration ownership”; “fix(db): allow startup migration index builds beyond query budget”; “fix(db): shorten transactions and prune system events by row count”; “fix: recover Book imports and align SMTP requests [skip ci]”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/db/sqlite.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/imports/infrastructure/pdf_inspection.py apps/api-python/app/modules/imports/infrastructure/pdf_inspection.py:18 — apps/api-python/app/modules/imports/infrastructure/pdf_inspection.py changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is pdf_inspection.inspect_pdf at line 18), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(pdf): merge bounded XMP metadata and split subject tags for v1.4.1”; “fix(backend): retain real failures in imports and background processing”; “fix(imports): restrict inspection to bounded metadata reads”; “fix(imports): enforce canonical typed queue paths”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/imports/infrastructure/pdf_inspection.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py:240 — apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is SqlAlchemyImportedBookMetadata.apply at line 240), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: unify tolerant TXT decoding and library maintenance”; “fix(backend): retain real failures in imports and background processing”; “fix(imports): preserve publication titles in flat libraries”; “fix(metadata): identify local metadata before manual lookup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: scripts/container_install.py scripts/container_install.py:221 — scripts/container_install.py changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is Installation.synchronize at line 221), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): diagnose gateway startup and update failures”; “fix(updates): harden installation recovery and runtime state reporting”; “fix: allow container restart after update failures and add book shelf action”; “fix(updates): simplify online verification and release v1.3.0”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- scripts/container_install.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt:559 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is ComicNavigatorFragment.ComicPageImage at line 559), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(android): preserve comic page while continuous images decode”; “fix(android): let zoomed comic drags reach image scrolling”; “fix(android): preserve comic image fit and expose overflow edges”; “fix(android): recreate comic pager when page grouping changes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/media/infrastructure/resource_preview.py apps/api-python/app/modules/media/infrastructure/resource_preview.py:79 — apps/api-python/app/modules/media/infrastructure/resource_preview.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is FilesystemResourcePreview._source at line 79), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(media): share archive page index with book details and previews”; “fix: unify tolerant TXT decoding and library maintenance”; “fix(imports): bound scheduled scans and expire preview caches”; “fix(backend): retain real failures in imports and background processing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/media/infrastructure/resource_preview.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/services/log_maintenance.py apps/api-python/app/services/log_maintenance.py:61 — apps/api-python/app/services/log_maintenance.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is SystemEventMaintenanceWorker._recover_startup_maintenance at line 61), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: unify tolerant TXT decoding and library maintenance”; “fix(imports): bound scheduled scans and expire preview caches”; “fix(backend): retain real failures in imports and background processing”; “fix(api): defer optional recovery and isolate startup components”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/services/log_maintenance.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/core/logging_config.py apps/api-python/app/core/logging_config.py:93 — apps/api-python/app/core/logging_config.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is logging_config.configure_logging at line 93), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(diagnostics): render parameterized logs before sanitizing”; “fix(diagnostics): preserve uvicorn access args and escape SQL params”; “fix(diagnostics): close sanitization and exception-group gaps”; “fix(diagnostics): unify safe output and harden exception boundaries”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/core/logging_config.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/db/session.py apps/api-python/app/db/session.py:61 — apps/api-python/app/db/session.py changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is session.release_read_transaction at line 61), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(db): shorten transactions and prune system events by row count”; “fix(sqlite): separate statement budgets from lock waits”; “fix(library): unify rescans and local cover metadata”; “fix: prioritize requests during facet indexing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/db/session.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/web/components/book/bookshelf.tsx apps/web/components/book/bookshelf.tsx:155 — apps/web/components/book/bookshelf.tsx changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is bookshelf.useHorizontalDragScroll.onKeyDown at line 155), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: refine import filters, metadata display and settings across clients”; “fix: align import visibility and library filtering”; “fix(library): align book list projections”; “fix: 完善书库浏览与阅读进度展示”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/components/book/bookshelf.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/library/infrastructure/move_topology.py apps/api-python/app/modules/library/infrastructure/move_topology.py:153 — apps/api-python/app/modules/library/infrastructure/move_topology.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is SqlAlchemyMoveTopology.destination at line 153), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: unify tolerant TXT decoding and library maintenance”; “fix(mcp): reimport moved volumes while preserving complete book identities”; “fix(mcp): preserve recovery locations and invalidate rewritten file versions”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/library/infrastructure/move_topology.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/web/features/reader/v3/original-publication/mobi-core.worker.ts apps/web/features/reader/v3/original-publication/mobi-core.worker.ts:114 — apps/web/features/reader/v3/original-publication/mobi-core.worker.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is mobi-core.worker.loadRuntime at line 114), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(reader): allow absent optional strings in MOBI WebAssembly metadata”; “fix(reader): keep only per-file 2 GiB import admission on web and backend”; “fix(web): support original publication storage and integrity checks over HTTP”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/web/features/reader/v3/original-publication/mobi-core.worker.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/system/infrastructure/settings.py apps/api-python/app/modules/system/infrastructure/settings.py:55 — apps/api-python/app/modules/system/infrastructure/settings.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is settings.get_settings_raw at line 55), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(settings): enforce JSON storage and correct optional metadata diagnostics”; “fix(backend): retain real failures in imports and background processing”; “fix(system): prepare setting deletes before writes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/system/infrastructure/settings.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/library/application/imported_book_metadata.py apps/api-python/app/modules/library/application/imported_book_metadata.py:139 — apps/api-python/app/modules/library/application/imported_book_metadata.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is IdentifyImportedBook._persist_identification at line 139), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(db): shorten transactions and prune system events by row count”; “fix(imports): preserve publication titles in flat libraries”; “fix(metadata): identify local metadata before manual lookup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/library/application/imported_book_metadata.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/auth/infrastructure/user_administration.py apps/api-python/app/modules/auth/infrastructure/user_administration.py:214 — apps/api-python/app/modules/auth/infrastructure/user_administration.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is SqlAlchemyUserAdministrationGateway.delete_user at line 214), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: unify tolerant TXT decoding and library maintenance”; “fix(db): shorten transactions and prune system events by row count”; “fix(backend): retain real failures in imports and background processing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/auth/infrastructure/user_administration.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/imports/infrastructure/library_scan_settings.py apps/api-python/app/modules/imports/infrastructure/library_scan_settings.py:30 — apps/api-python/app/modules/imports/infrastructure/library_scan_settings.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is SqlAlchemyLibraryScanSettingsRepository.load at line 30), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(settings): enforce JSON storage and correct optional metadata diagnostics”; “fix(imports): bound scheduled scans and expire preview caches”; “fix(backend): retain real failures in imports and background processing”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/imports/infrastructure/library_scan_settings.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/backup/presentation/http.py apps/api-python/app/modules/backup/presentation/http.py:131 — apps/api-python/app/modules/backup/presentation/http.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is http.upload_backup at line 131), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(db): shorten transactions and prune system events by row count”; “fix: release v1.5.1 backup management and HTTP book deletion”; “fix(api): expose traceable HTTP and MCP failures without misclassification”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/backup/presentation/http.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: apps/api-python/app/modules/metadata/infrastructure/short_writes.py apps/api-python/app/modules/metadata/infrastructure/short_writes.py:21 — apps/api-python/app/modules/metadata/infrastructure/short_writes.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is short_writes.metadata_short_write_session at line 21), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(db): shorten transactions and prune system events by row count”; “fix(sqlite): separate statement budgets from lock waits”; “fix(library): unify rescans and local cover metadata”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- apps/api-python/app/modules/metadata/infrastructure/short_writes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: scripts/dependency_environment.py scripts/dependency_environment.py:93 — scripts/dependency_environment.py changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is dependency_environment.validate_dependency_seed at line 93), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): diagnose gateway startup and update failures”; “fix(updates): harden installation recovery and runtime state reporting”; “fix(container): synchronize runtime when image identity changes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-06..2026-11-04, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-06 22:35:30 +08:00' --until='2026-11-04 22:35:30 +08:00' --full-history --no-merges -- scripts/dependency_environment.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×19
  • Duplicated block (6 lines × 2) apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.py:34 — apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.py:34-41 | apps/api-python/app/db/alembic/versions/0030_book_import_task_shape.py:14-19 — 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 `apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.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) apps/api-python/app/modules/library/infrastructure/file_move_io.py:65 — apps/api-python/app/modules/library/infrastructure/file_move_io.py:65-70 | apps/api-python/app/modules/library/infrastructure/file_move_io.py:145-150 — both copies are in the same file, so extract the block into 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) apps/api-python/app/modules/library/domain/layout.py:149 — apps/api-python/app/modules/library/domain/layout.py:149-154 | apps/api-python/app/modules/library/domain/source_nodes.py:219-224 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) apps/api-python/app/modules/auth/presentation/users.py:80 — apps/api-python/app/modules/auth/presentation/users.py:80-85 | apps/api-python/app/modules/reader/presentation/v5.py:143-148 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) apps/api-python/app/modules/imports/infrastructure/uploaded_file_publication.py:167 — apps/api-python/app/modules/imports/infrastructure/uploaded_file_publication.py:167-172 | apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:197-202 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `target` to `UploadTarget` in one and `StandardWriteFile` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476-481 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSystemScreens.kt:251-256 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:365 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:365-370 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:184-190 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:365` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:560 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:560-565 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:579-584 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:560` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:50 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:50-55 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/RemoteComicReadiumPublicationFactory.kt:34-39 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt: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.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:276 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:276-281 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:285-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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:276` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:61 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:61-66 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:83-88 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:61` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1598 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1598-1603 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1645-1650 — both copies are in the same file, so extract the block into 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/DownloadResourceRow.kt:235 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/DownloadResourceRow.kt:235-240 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:965-970 — 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:354 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:354-359 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:175-180 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:354` 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) apps/mobile/iosApp/ErmaoLibrary/Application/SharedShelfClient.swift:46 — apps/mobile/iosApp/ErmaoLibrary/Application/SharedShelfClient.swift:46-55 | apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/SharedShelfCatalogClient.swift:59-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderLocalDatabase.swift:180 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderLocalDatabase.swift:180-185 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderPrivateContentCache.swift:35-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. 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 (6 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:217 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:217-222 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:141-146 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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 (6 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:234 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:234-239 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:201-206 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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 (6 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:295 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:295-300 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosTxtPublicationFactory.swift:245-250 — 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.
AC4 · Keyboard semantics · Modal dialog does not manage focus · ×17
  • Modal dialog does not manage focus apps/web/components/system/pwa-client.tsx:400 — This <div role="alertdialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/components/ui/feedback.tsx:118 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/book-detail-page.tsx:170 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/kindle-send-modal.tsx:86 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/metadata-lookup-modal.tsx:314 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/metadata-lookup-modal.tsx:449 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/ui/book-metadata-editor.tsx:117 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/ui/source-node-metadata-dialogs.tsx:73 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/books/ui/source-node-metadata-dialogs.tsx:186 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/library/library-batch-actions.tsx:366 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/library/upload-book-dialog.tsx:84 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/organize/classification-management-panel.tsx:218 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/organize/metadata-providers-panel.tsx:228 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/settings/center/users-permissions-page.tsx:437 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/settings/center/users-permissions-page.tsx:454 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/settings/setup-page.tsx:214 — This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus apps/web/features/settings/setup-page.tsx:234 — This <section role="alertdialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×16
  • Swallowed exception (caught, then discarded) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:74 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:87 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:153 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:251 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:768 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:389 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1952 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:2042 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:734 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:784 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:820 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:907 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:991 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1134 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1262 — `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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlSession.swift:220 — `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.
AC6 · Visual & motion safety · Focus outline removed inline · ×15
  • Focus outline removed inline apps/web/components/ui/multi-value-combobox.tsx:352 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/books/ui/book-content-browser.tsx:35 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline REDACTED:280 — <textarea> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline REDACTED:287 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/library/library-batch-actions.tsx:449 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/library/library-page.tsx:532 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/management/management-logs-page.tsx:300 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/organize/classification-management-panel.tsx:153 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/organize/classification-management-panel.tsx:198 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/organize/metadata-providers-panel.tsx:232 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/organize/organize-page.tsx:312 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/reader/v3/reader-engine-runtime.tsx:649 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/settings/center/library-import-settings-page.tsx:32 — <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/settings/settings-page.tsx:645 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
  • Focus outline removed inline apps/web/features/shelves/shelves-page.tsx:841 — <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
X2 · Cancellation propagation · Async function without AbortSignal · ×15
  • Async function without AbortSignal: writeShelf apps/web/features/shelves/api/client.ts:76 — `writeShelf` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: deleteShelfById apps/web/features/shelves/api/client.ts:92 — `deleteShelfById` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: runBackupAction apps/web/features/settings/settings-page.tsx:263 — `runBackupAction` holds an AbortSignal but calls `loadBackups(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `loadBackups(…, { signal })`.
  • Async function without AbortSignal: loadImportPreferenceSettings apps/web/features/settings/api/import-preferences-client.ts:22 — `loadImportPreferenceSettings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: saveReaderBookmarks apps/web/features/reader/v3/api.ts:448 — `saveReaderBookmarks` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: loadRuntime apps/web/features/reader/v3/original-publication/mobi-core.worker.ts:114 — `loadRuntime` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: saveOrder apps/web/features/organize/metadata-providers-panel.tsx:108 — `saveOrder` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: updateProvider apps/web/features/organize/metadata-providers-panel.tsx:131 — `updateProvider` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchManagementEvents apps/web/features/management/api/events.ts:81 — `fetchManagementEvents` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchManagementEventDetail apps/web/features/management/api/events.ts:100 — `fetchManagementEventDetail` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: downloadManagementLogFiles apps/web/features/management/api/events.ts:111 — `downloadManagementLogFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: postJson apps/web/features/library/api/bulk-operations.ts:111 — `postJson` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: updateBulkBookCovers apps/web/features/library/api/bulk-operations.ts:195 — `updateBulkBookCovers` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: postUploadedFiles apps/web/features/library/api/save-uploaded-files.ts:68 — `postUploadedFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: loadInitialState apps/web/components/directory/target-directory-picker.tsx:120 — `loadInitialState` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×13
  • Edited copy of a member (10 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:112 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:112-122 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumNavigator.swift:39-48 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:27 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:27-36 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:38-47 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:305 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:305-314 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:352-361 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/library/application/catalog.py:192 — apps/api-python/app/modules/library/application/catalog.py:192-201 | apps/api-python/app/modules/library/application/groupings.py:65-74 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) REDACTED:217 — REDACTED:217-226 | apps/api-python/app/modules/imports/domain/volume_index.py:26-42 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/updates/presentation/http.py:83 — apps/api-python/app/modules/updates/presentation/http.py:83-92 | apps/api-python/app/modules/updates/presentation/http.py:201-210 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/metadata/infrastructure/lookup_queue.py:389 — apps/api-python/app/modules/metadata/infrastructure/lookup_queue.py:389-420 | apps/api-python/app/modules/organize/infrastructure/jobs.py:233-242 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/library/infrastructure/file_move_operations.py:47 — apps/api-python/app/modules/library/infrastructure/file_move_operations.py:47-56 | apps/api-python/app/modules/metadata/infrastructure/standard_writeback_store.py:52-61 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/system/infrastructure/events.py:138 — apps/api-python/app/modules/system/infrastructure/events.py:138-148 | apps/api-python/app/modules/system/infrastructure/runtime.py:131-140 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/core/authorization.py:156 — apps/api-python/app/core/authorization.py:156-165 | apps/api-python/app/modules/library/infrastructure/resource_commands.py:45-54 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/api-python/app/modules/auth/infrastructure/user_management_queries.py:59 — apps/api-python/app/modules/auth/infrastructure/user_management_queries.py:59-70 | REDACTED:142-151 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:158 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:158-167 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:870-880 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/content/ui/ContentComponents.kt:472 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/content/ui/ContentComponents.kt:472-481 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:469-478 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×13
  • Duplicated block (11 lines × 2) apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:117 — apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:117-127 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:151-161 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:117` 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) apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:44 — apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:44-54 | apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py:37-47 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py` and `apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) apps/api-python/app/modules/backup/presentation/http.py:164 — apps/api-python/app/modules/backup/presentation/http.py:164-174 | apps/api-python/app/modules/backup/presentation/http.py:278-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 × 2) apps/api-python/app/modules/media/presentation/http.py:130 — apps/api-python/app/modules/media/presentation/http.py:130-140 | apps/api-python/app/modules/media/presentation/http.py:172-182 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/media/presentation/http.py:130` 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 (11 lines × 2) apps/api-python/app/modules/metadata/infrastructure/selective_comicinfo.py:34 — apps/api-python/app/modules/metadata/infrastructure/selective_comicinfo.py:34-46 | apps/api-python/app/modules/metadata/infrastructure/selective_opf.py:58-68 — 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 `apps/api-python/app/modules/metadata/infrastructure/selective_comicinfo.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 (11 lines × 2) packages/reader-contracts/verify-reader-safety-conformance.py:309 — packages/reader-contracts/verify-reader-safety-conformance.py:309-319 | packages/reader-contracts/verify-reader-safety-conformance.py:458-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `packages/reader-contracts/verify-reader-safety-conformance.py:309` 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 after the matched lines, `packages/reader-contracts/verify-reader-safety-conformance.py:468` calls `get`, `_nullable_string` and `packages/reader-contracts/verify-reader-safety-conformance.py:319` 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 (11 lines × 2) packages/reader-contracts/verify-reader-safety-conformance.py:321 — packages/reader-contracts/verify-reader-safety-conformance.py:321-331 | packages/reader-contracts/verify-reader-safety-conformance.py:469-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `packages/reader-contracts/verify-reader-safety-conformance.py:321` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `packages/reader-contracts/verify-reader-safety-conformance.py:467` calls `_string`, `get` and `packages/reader-contracts/verify-reader-safety-conformance.py:320` 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1564 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1564-1574 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1611-1621 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1564` 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:449 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:449-459 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:309-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:449` 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1852 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1852-1864 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1908-1918 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1852` 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) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:383 — apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:383-393 | apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:403-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:383` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:284 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:284-294 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:247-257 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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 (11 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:50 — apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:50-60 | apps/mobile/iosApp/ErmaoLibrary/Features/Server/TLSRiskView.swift:18-28 — 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, `apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:47` calls `Text`, `LocalizedStringKey`, `appTextStyle` and `apps/mobile/iosApp/ErmaoLibrary/Features/Server/TLSRiskView.swift:16` 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 × 2) · ×13
  • Duplicated block (10 lines × 2) apps/api-python/app/modules/library/presentation/http.py:1336 — apps/api-python/app/modules/library/presentation/http.py:1336-1345 | apps/api-python/app/modules/library/presentation/http.py:1391-1400 — both copies are in the same file, so extract the 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 lines × 2) apps/api-python/app/modules/media/presentation/http.py:478 — apps/api-python/app/modules/media/presentation/http.py:478-487 | apps/api-python/app/modules/reader/presentation/v5.py:1052-1061 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/modules/reader/presentation/v5.py:1051` calls `expunge_all` and `apps/api-python/app/modules/media/presentation/http.py:477` 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 (10 lines × 2) REDACTED:58 — REDACTED:58-67 | REDACTED:164-173 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) apps/api-python/app/services/download_queue.py:180 — apps/api-python/app/services/download_queue.py:180-189 | apps/api-python/app/services/kindle_queue.py:506-515 — before extracting anything, compare `apps/api-python/app/services/download_queue.py` and `apps/api-python/app/services/kindle_queue.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:351 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:351-360 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:394-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:351` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:52 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:52-61 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:90-99 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:52` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:188 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:188-197 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:242-251 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:188` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:185` calls `takeIf` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:239` 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 (10 lines × 2) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:151 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:151-160 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:290-299 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:151` 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) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:339 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:339-348 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:442-451 — both copies are in the same file, so extract the 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:339` 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) apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:206 — apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:206-215 | apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:266-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:68 — apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:68-77 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:454-463 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:74 — apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:74-83 | apps/mobile/iosApp/ErmaoLibrary/Features/Server/ServerFlowView.swift:125-134 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Server/IncompatibleServerView.swift:74` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:40 — apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:40-49 | apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:113-125 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×13
  • Duplicated block (9 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:939 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:939-947 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1102-1110 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:939` 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) apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:66 — apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:66-74 | apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py:67-75 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py` and `apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (9 lines × 2) apps/api-python/app/modules/auth/infrastructure/transactions.py:157 — apps/api-python/app/modules/auth/infrastructure/transactions.py:157-165 | apps/api-python/app/modules/auth/infrastructure/transactions.py:322-330 — both copies are in the same file, so extract the block into 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) apps/api-python/app/modules/backup/infrastructure/persistence.py:230 — apps/api-python/app/modules/backup/infrastructure/persistence.py:230-238 | apps/api-python/app/modules/backup/infrastructure/persistence.py:246-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) apps/api-python/app/modules/library/application/file_deletions.py:211 — apps/api-python/app/modules/library/application/file_deletions.py:211-219 | apps/api-python/app/modules/library/application/file_deletions.py:228-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:401 — apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:401-409 | apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:466-474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) apps/api-python/app/modules/organize/infrastructure/policy.py:56 — apps/api-python/app/modules/organize/infrastructure/policy.py:56-64 | apps/api-python/app/modules/organize/infrastructure/runs.py:70-78 — 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 (9 lines × 2) apps/api-python/app/modules/reader/infrastructure/resource_repository.py:137 — apps/api-python/app/modules/reader/infrastructure/resource_repository.py:137-145 | apps/api-python/app/modules/reader/infrastructure/v5_repository.py:193-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1123 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1123-1131 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1149-1157 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1989 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1989-1997 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:2100-2108 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1989` 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) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:74 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:74-82 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/RemoteComicReadiumPublicationFactory.kt:59-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:74` 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. 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) apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:181 — apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:181-189 | apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:141-149 — 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 `apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:309 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:309-317 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:333-341 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:309` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×12
  • Duplicated block (7 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1285 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1285-1291 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2180-2186 — both copies are in the same file, so extract the block into 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) apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:45 — apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:45-51 | apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py:46-52 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py` and `apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (7 lines × 2) apps/api-python/app/modules/library/infrastructure/resource_cover.py:143 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:143-149 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:119-125 — before extracting anything, compare `apps/api-python/app/modules/library/infrastructure/resource_cover.py` and `apps/api-python/app/modules/library/infrastructure/source_node_cover.py` as WHOLE FILES: this scan already matched 5 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `published` to `PublishedResourceCover` in one and `PublishedSourceNodeCover` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:243 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:243-249 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:261-267 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:243` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/AndroidEncryptedCookieVault.kt:71 — apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/AndroidEncryptedCookieVault.kt:71-77 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/SerializedCookieVault.kt:62-68 — 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) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:310 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:310-316 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:413-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:310` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:373 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:373-379 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:392-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:373` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:344 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:344-350 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderPositionSyncPort.kt:103-109 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:176 — apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:176-182 | apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:222-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.
  • Duplicated block (7 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:337 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:337-343 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:367-373 — both copies are in the same file, so extract the block into 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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:347 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:347-353 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:361-367 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:347` 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.
  • Duplicated block (7 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:586 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:586-593 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:600-606 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:586` 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 (8 lines × 2) · ×11
  • Duplicated block (8 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:73 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:73-80 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:533-540 — both copies are in the same file, so extract the 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:532` calls `Column`, `String` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.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.
  • Duplicated block (8 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:663 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:663-670 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1816-1823 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:663` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) apps/api-python/app/modules/automation/application/file_moves.py:65 — apps/api-python/app/modules/automation/application/file_moves.py:65-72 | apps/api-python/app/modules/automation/application/writebacks.py:114-121 — 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) apps/api-python/app/modules/automation/application/uploads.py:448 — apps/api-python/app/modules/automation/application/uploads.py:448-455 | apps/api-python/app/modules/automation/application/uploads.py:492-499 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:381 — apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:381-388 | apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:450-457 — both copies are in the same file, so extract the block into 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) REDACTED:204 — REDACTED:204-211 | apps/api-python/app/modules/publications/infrastructure/mobi_adapter.py:162-172 — 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 (8 lines × 2) apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:66 — apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:66-73 | apps/api-python/app/modules/library/infrastructure/resource_commands.py:35-42 — 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 (8 lines × 2) apps/api-python/app/modules/library/infrastructure/resource_cover.py:152 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:152-159 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:131-138 — before extracting anything, compare `apps/api-python/app/modules/library/infrastructure/resource_cover.py` and `apps/api-python/app/modules/library/infrastructure/source_node_cover.py` as WHOLE FILES: this scan already matched 5 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. 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) apps/api-python/app/modules/reader/infrastructure/resource_repository.py:150 — apps/api-python/app/modules/reader/infrastructure/resource_repository.py:150-157 | apps/api-python/app/modules/reader/infrastructure/v5_repository.py:206-213 — 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 (8 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1455 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1455-1462 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1480-1487 — both copies are in the same file, so extract the block into 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) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:238 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:238-245 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:276-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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:238` 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.
R11 · Import Boundaries · Boundary violation [package · ×11
  • Boundary violation [package:relative-cross-package] apps/web/features/reader/api/client.ts:1 — apps/web/features/reader/api/client.ts:1 reaches into another package with a relative path (../../../../../packages/reader-contracts/reader-http-error-statuses.json) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/generate-i18n-catalog.mjs:8 — apps/web/scripts/generate-i18n-catalog.mjs:8 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/migrate-i18n-jsx-attributes.mjs:7 — apps/web/scripts/migrate-i18n-jsx-attributes.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/migrate-i18n-jsx-expressions.mjs:7 — apps/web/scripts/migrate-i18n-jsx-expressions.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/migrate-i18n-jsx-text.mjs:7 — apps/web/scripts/migrate-i18n-jsx-text.mjs:7 reaches into another package with a relative path (../node_modules/typescript) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/prepare-pdfjs-worker.mjs:6 — apps/web/scripts/prepare-pdfjs-worker.mjs:6 reaches into another package with a relative path (../node_modules/pdfjs-dist/package.json) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] apps/web/scripts/prepare-pdfjs-worker.mjs:7 — apps/web/scripts/prepare-pdfjs-worker.mjs:7 reaches into another package with a relative path (../node_modules/pdfjs-dist/legacy/build/pdf.worker.mjs) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] prototypes/feedback-web/generate-icons.mjs:4 — prototypes/feedback-web/generate-icons.mjs:4 reaches into another package with a relative path (../../REDACTED) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] scripts/container_update_browser.mjs:4 — scripts/container_update_browser.mjs:4 reaches into another package with a relative path (../apps/web/e2e/reader-controls.ts) — import the package by name instead.
  • Boundary violation [package:test-suite-dependency] scripts/container_update_browser.mjs:4 — scripts/container_update_browser.mjs:4 imports apps/web/e2e/reader-controls.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:relative-cross-package] scripts/container_update_browser.mjs:5 — scripts/container_update_browser.mjs:5 reaches into another package with a relative path (../REDACTED) — import the package by name instead.
D31 · IaC & Container Security · Medium IaC · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×10
  • Edited copy of a member (15 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:465 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:465-481 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/me/ui/MeScreens.kt:677-691 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:130 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:130-144 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:595-610 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:272 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:272-286 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:513-530 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:253 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:253-267 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1082-1099 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/api-python/app/modules/media/infrastructure/http_streaming.py:208 — apps/api-python/app/modules/media/infrastructure/http_streaming.py:208-222 | apps/api-python/app/modules/media/infrastructure/http_streaming.py:226-241 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:670 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:670-684 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/infrastructure/KtorPersonalSettingsRepository.kt:289-304 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:361 — apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:361-378 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:398-412 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) REDACTED:343 — REDACTED:343-359 | REDACTED:400-414 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/AdministrativeSettingsContract.kt:20 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/AdministrativeSettingsContract.kt:20-34 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/PersonalSettingsPublic.kt:15-30 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) apps/api-python/app/modules/auth/infrastructure/user_data.py:149 — apps/api-python/app/modules/auth/infrastructure/user_data.py:149-163 | apps/api-python/app/modules/system/infrastructure/settings.py:91-105 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×10
  • Edited copy of a member (13 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:341 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:341-353 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:355-368 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsWire.kt:658 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsWire.kt:658-670 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsWire.kt:910-924 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:598 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:598-614 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:644-656 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/application/PdfRangeLoader.kt:173 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/application/PdfRangeLoader.kt:173-185 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/application/PdfRangeLoader.kt:196-208 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/api-python/app/modules/automation/application/file_moves.py:101 — apps/api-python/app/modules/automation/application/file_moves.py:101-115 | apps/api-python/app/modules/automation/application/writebacks.py:149-161 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/api-python/app/modules/automation/application/file_moves.py:47 — apps/api-python/app/modules/automation/application/file_moves.py:47-60 | apps/api-python/app/modules/automation/application/writebacks.py:97-109 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:327 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:327-340 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:416-428 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:590 — apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:590-602 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:604-616 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidReaderV5Database.kt:89 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidReaderV5Database.kt:89-103 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidReaderV5Database.kt:191-203 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) apps/api-python/app/bootstrap/kindle.py:133 — apps/api-python/app/bootstrap/kindle.py:133-145 | apps/api-python/app/modules/kindle/infrastructure/tasks.py:210-223 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×10
  • Edited copy of a member (8 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:228 — apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:228-247 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsComponents.swift:104-111 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:212 — apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:212-219 | apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:258-266 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/application/ReaderScreenController.kt:114 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/application/ReaderScreenController.kt:114-121 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:393-406 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ComicReaderSemantics.kt:283 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ComicReaderSemantics.kt:283-290 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ComicReaderSemantics.kt:297-304 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1249 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1249-1259 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1905-1912 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:617 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:617-625 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:667-674 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/api-python/app/services/audio_metadata.py:924 — apps/api-python/app/services/audio_metadata.py:924-931 | apps/api-python/app/services/audio_metadata.py:935-943 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:118 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:118-125 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:581-589 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:186 — apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:186-194 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1805-1812 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) scripts/python_backend_sample_smoke.py:152 — scripts/python_backend_sample_smoke.py:152-159 | scripts/python_worker_import_smoke.py:95-105 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×10
  • Duplicated block (15 lines × 2) apps/api-python/app/db/sqlite.py:352 — apps/api-python/app/db/sqlite.py:352-366 | apps/api-python/app/db/sqlite.py:372-386 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) apps/api-python/app/modules/download/presentation/http.py:390 — apps/api-python/app/modules/download/presentation/http.py:390-404 | apps/api-python/app/modules/download/presentation/http.py:413-427 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/download/presentation/http.py:390` 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 (15 lines × 2) apps/api-python/app/modules/library/infrastructure/resource_cover.py:115 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:115-129 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:91-105 — before extracting anything, compare `apps/api-python/app/modules/library/infrastructure/resource_cover.py` and `apps/api-python/app/modules/library/infrastructure/source_node_cover.py` as WHOLE FILES: this scan already matched 5 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.
  • Duplicated block (15 lines × 2) apps/api-python/app/modules/reader/presentation/v5.py:764 — apps/api-python/app/modules/reader/presentation/v5.py:764-778 | apps/api-python/app/modules/reader/presentation/v5.py:819-833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/reader/presentation/v5.py:764` 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) apps/api-python/app/modules/shelf/application/commands.py:153 — apps/api-python/app/modules/shelf/application/commands.py:153-167 | apps/api-python/app/modules/shelf/application/commands.py:246-260 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/shelf/application/commands.py: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. 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 (15 lines × 2) apps/api-python/app/modules/updates/presentation/http.py:115 — apps/api-python/app/modules/updates/presentation/http.py:115-129 | apps/api-python/app/modules/updates/presentation/http.py:158-172 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/updates/presentation/http.py:115` 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 (15 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:793 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:793-807 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:30-44 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:793` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:87 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:87-101 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:203-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:87` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:66 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:66-80 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:67-81 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1205 — apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1205-1219 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1247-1261 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1205` 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 lines × 2) · ×10
  • Duplicated block (12 lines × 2) apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:44 — apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:44-55 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:168-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:56` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:180` 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 (12 lines × 2) REDACTED:413 — REDACTED:413-424 | REDACTED:499-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.
  • Duplicated block (12 lines × 2) apps/api-python/app/modules/library/infrastructure/book_list.py:274 — apps/api-python/app/modules/library/infrastructure/book_list.py:274-285 | apps/api-python/app/modules/library/infrastructure/books.py:285-296 — 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 `apps/api-python/app/modules/library/infrastructure/book_list.py:274` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/modules/library/infrastructure/book_list.py:287` calls `asc` and `apps/api-python/app/modules/library/infrastructure/books.py:298` 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 (12 lines × 2) apps/api-python/app/modules/library/infrastructure/resource_cover.py:87 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:87-98 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:63-74 — before extracting anything, compare `apps/api-python/app/modules/library/infrastructure/resource_cover.py` and `apps/api-python/app/modules/library/infrastructure/source_node_cover.py` as WHOLE FILES: this scan already matched 5 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.
  • Duplicated block (12 lines × 2) apps/api-python/app/modules/shelf/presentation/http.py:504 — apps/api-python/app/modules/shelf/presentation/http.py:504-515 | apps/api-python/app/modules/shelf/presentation/http.py:532-543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/shelf/presentation/http.py:504` 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) apps/api-python/app/services/download_queue.py:38 — apps/api-python/app/services/download_queue.py:38-49 | apps/api-python/app/services/kindle_queue.py:393-404 — before extracting anything, compare `apps/api-python/app/services/download_queue.py` and `apps/api-python/app/services/kindle_queue.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/services/download_queue.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 (12 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:131 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/application/HomeViewModel.kt:131-142 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:596-607 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:348 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:348-359 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:270-281 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:348` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:342 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:342-353 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderModels.swift:131-142 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:342` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1221 — apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1221-1232 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1263-1274 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1221` 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 · Edited copy of a member (9 corresponding lines) · ×9
  • Edited copy of a member (9 corresponding lines) apps/api-python/app/modules/library/infrastructure/categories.py:39 — apps/api-python/app/modules/library/infrastructure/categories.py:39-47 | apps/api-python/app/modules/shelf/infrastructure/shelves.py:130-139 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:807 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:807-815 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:817-830 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:176 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:176-186 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:87-95 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlAdapters.swift:21 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlAdapters.swift:21-29 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlAdapters.swift:30-38 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/SharedShelfClient.swift:57 — apps/mobile/iosApp/ErmaoLibrary/Application/SharedShelfClient.swift:57-65 | apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/SharedShelfCatalogClient.swift:66-74 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/api-python/app/modules/auth/presentation/users.py:186 — apps/api-python/app/modules/auth/presentation/users.py:186-196 | apps/api-python/app/modules/auth/presentation/users.py:213-221 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/api-python/app/modules/library/infrastructure/join_queries.py:109 — apps/api-python/app/modules/library/infrastructure/join_queries.py:109-120 | apps/api-python/app/modules/library/infrastructure/projections.py:86-94 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubChapterProjection.swift:287 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubChapterProjection.swift:287-295 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:140-148 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/application/DownloadResourceRuntime.kt:282 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/application/DownloadResourceRuntime.kt:282-290 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:333-341 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D29 · Static Analysis (SAST) · REDACTED · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×8
  • Edited copy of a member (7 corresponding lines) apps/api-python/app/modules/library/infrastructure/books.py:306 — apps/api-python/app/modules/library/infrastructure/books.py:306-314 | apps/api-python/app/modules/library/infrastructure/books.py:318-324 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderLocalDatabase.swift:179 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderLocalDatabase.swift:179-185 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderPrivateContentCache.swift:34-40 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:29 — apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:29-37 | apps/api-python/shuku_dependencies/installed.py:16-22 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:323 — apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:323-329 | apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/SharedShelfCatalogClient.swift:58-64 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioAdapters.swift:6 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioAdapters.swift:6-15 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioAdapters.swift:17-23 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) apps/api-python/app/modules/reader/application/exact_location.py:16 — apps/api-python/app/modules/reader/application/exact_location.py:16-24 | apps/api-python/app/modules/reader/infrastructure/exact_location_codec.py:93-99 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) scripts/python_release_live_fixture.py:125 — scripts/python_release_live_fixture.py:125-131 | scripts/python_release_load_precheck.py:114-120 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) scripts/container_image.py:170 — scripts/container_image.py:170-176 | scripts/container_install.py:284-290 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×8
  • Duplicated block (5 lines × 2) apps/api-python/app/modules/library/infrastructure/books.py:308 — apps/api-python/app/modules/library/infrastructure/books.py:308-313 | apps/api-python/app/modules/library/infrastructure/books.py:319-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/library/infrastructure/books.py:308` 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 (5 lines × 2) apps/api-python/app/modules/kindle/infrastructure/tasks.py:29 — apps/api-python/app/modules/kindle/infrastructure/tasks.py:29-33 | apps/api-python/app/modules/shelf/infrastructure/shelves.py:25-29 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1853 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1853-1857 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2172-2176 — both copies are in the same file, so extract the 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1852` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2171` 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 × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/EpubContentSecurityPolicy.kt:273 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/EpubContentSecurityPolicy.kt:273-277 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/EpubContentSecurityPolicy.kt:281-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:563 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:563-567 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:583-587 — both copies are in the same file, so extract the 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/application/DefaultMobileRuntime.kt:563` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/AndroidEncryptedCookieVault.kt:35 — apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/AndroidEncryptedCookieVault.kt:35-39 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/SerializedCookieVault.kt:35-39 — 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) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:32 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:32-36 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:43-47 — both copies are in the same file, so extract the 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/AdministrativeSettingsRequests.kt:32` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Design/AppTheme.swift:60 — apps/mobile/iosApp/ErmaoLibrary/Design/AppTheme.swift:60-64 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:692-696 — 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×7
  • Edited copy of a member (17 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:375 — apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:375-393 | apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:272-292 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:353 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AtomicDownloadFileSink.kt:353-370 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:174-190 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:330 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:330-346 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:352-369 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/api-python/app/modules/library/presentation/http.py:1234 — apps/api-python/app/modules/library/presentation/http.py:1234-1250 | apps/api-python/app/modules/library/presentation/http.py:1641-1658 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsStore.swift:89 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsStore.swift:89-106 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsStore.swift:108-124 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:661 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:661-679 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:681-697 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) apps/api-python/app/bootstrap/automation.py:259 — apps/api-python/app/bootstrap/automation.py:259-275 | apps/api-python/app/bootstrap/automation.py:279-297 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×7
  • Edited copy of a member (18 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:372 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:372-389 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:391-409 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/api-python/app/db/sqlite.py:349 — apps/api-python/app/db/sqlite.py:349-366 | apps/api-python/app/db/sqlite.py:369-386 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:169 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:169-186 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:189-209 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/api-python/app/modules/library/application/commands/manage_source_tree.py:290 — apps/api-python/app/modules/library/application/commands/manage_source_tree.py:290-307 | apps/api-python/app/modules/library/application/commands/manage_source_tree.py:323-340 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/infrastructure/KtorPersonalSettingsRepository.kt:217 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/infrastructure/KtorPersonalSettingsRepository.kt:217-234 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/infrastructure/KtorPersonalSettingsRepository.kt:239-260 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/api-python/app/services/download_queue.py:65 — apps/api-python/app/services/download_queue.py:65-82 | apps/api-python/app/services/kindle_queue.py:420-439 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/SessionStore.swift:74 — apps/mobile/iosApp/ErmaoLibrary/Application/SessionStore.swift:74-91 | apps/mobile/iosApp/ErmaoLibrary/Application/SessionStore.swift:250-267 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×7
  • Edited copy of a member (12 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:554 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:554-565 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/LibraryScreen.kt:573-584 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/api-python/app/modules/library/infrastructure/source_paths.py:10 — apps/api-python/app/modules/library/infrastructure/source_paths.py:10-26 | apps/api-python/app/modules/media/infrastructure/resource_preview.py:173-184 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:84 — apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:84-95 | apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:97-108 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:353 — apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:353-364 | apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:462-473 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Me/AvatarImageProcessor.swift:154 — apps/mobile/iosApp/ErmaoLibrary/Features/Me/AvatarImageProcessor.swift:154-166 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/AvatarImageProcessor.swift:168-179 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioModels.swift:362 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioModels.swift:362-374 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:173-184 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/PreviewMobileRuntime.swift:106 — apps/mobile/iosApp/ErmaoLibrary/Application/PreviewMobileRuntime.swift:106-117 | apps/mobile/iosApp/ErmaoLibrary/Application/SharedRuntimeAdapter.swift:115-128 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×7
  • Edited copy of a member (14 corresponding lines) apps/api-python/app/services/download_queue.py:38 — apps/api-python/app/services/download_queue.py:38-51 | apps/api-python/app/services/kindle_queue.py:393-406 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:623 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:623-636 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:638-651 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:56 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:56-69 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:78-91 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/api-python/app/modules/library/infrastructure/join_queries.py:21 — apps/api-python/app/modules/library/infrastructure/join_queries.py:21-34 | apps/api-python/app/modules/library/infrastructure/join_queries.py:38-60 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:340 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:340-353 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderModels.swift:129-142 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:51 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:51-64 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:326-340 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:111 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:111-125 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageScaffolds.kt:149-162 — 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.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×7
  • Recursive walk over a caller-supplied document has no depth cap apps/web/lib/reader/v5-wire.ts:111 — `parseReaderV5Presentation` is exported, takes a document from its caller (line 197) and hands it to `isJsonValue`, which calls itself at line 111 (`isJsonValue`) with a piece of `value` (and at line 112) — and nowhere in `isJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `isJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap apps/web/features/shelves/api/schemas.ts:124 — `parseShelfView` is exported and takes `value: unknown` from its caller, and it calls itself at line 124 (`parseShelfView`) with a piece of `value` — and nowhere in `parseShelfView` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `parseShelfView` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:406 — `parse` is not private, takes a value from its caller (line 42) and hands it on to `normalizeMap`, which calls itself at line 406 with a piece of `raw` — and nowhere in the walk is a depth or nesting counter compared with a bound, nor is the parser that builds the document given a nesting limit in this file. The walk therefore spends one stack frame (more through a lambda or a stream) per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes; javac turns no recursive call into a loop. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25). org.json, the W3C DOM, dom4j and StAX set no nesting limit of their own, Jackson before 2.15 none and 2.15+ 1,000 — on a cold JVM past the point the walk fails — and a `Map<String, Object>` tree is as deep as whatever built it. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (Exception e)` around the call does not stop it, and the request or the thread dies with it. Thread a depth argument through `normalizeMap` and reject the value past a fixed maximum, configure the parser's nesting limit (`StreamReadConstraints.maxNestingDepth`, SnakeYAML's `setNestingDepthLimit`), or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap REDACTED:196 — `process_metadata_lookup_task` is public, takes a document from its caller (line 709) and hands it to `_parse_tags`, which calls itself at line 196 (`_parse_tags`) with a piece of `value` — and nowhere in `_parse_tags` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_parse_tags` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap REDACTED:129 — `metadata_candidate_title_values` is public, takes a document from its caller (line 139) and hands it to `_metadata_title_strings`, which calls itself at line 129 (`_metadata_title_strings`) with a piece of `value` (and at line 134) — and nowhere in `_metadata_title_strings` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_metadata_title_strings` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap apps/api-python/app/schemas/responses.py:14 — `ok` is public, takes a document from its caller (line 24) and hands it to `_normalize_timestamps`, which calls itself at line 14 (`_normalize_timestamps`) with a piece of `value` (and at line 18) — and nowhere in `_normalize_timestamps` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_normalize_timestamps` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap REDACTED:90 — `xml_chapter_events` is public and takes `root: ElementTree.Element` from its caller, and it calls itself at line 90 (`xml_chapter_events`) with a piece of `root` — and nowhere in `xml_chapter_events` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `xml_chapter_events` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×6
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:54 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:54-54 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:112-118 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/LibrarySettingsViews.swift:213 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/LibrarySettingsViews.swift:213-213 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/LibrarySettingsViews.swift:254-262 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:185 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:185-185 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/OrganizationSettingsViews.swift:182-182 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/OrganizationSettingsViews.swift:230 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/OrganizationSettingsViews.swift:230-230 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/LibrarySettingsViews.swift:319-319 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:312 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:312-315 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/OrganizationSettingsViews.swift:49-49 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsMapping.swift:18 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsMapping.swift:18-18 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/SharedSettingsClient.swift:167-169 — These two members are one piece of code written twice and then edited apart: 1 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.
AC3 · Page structure · Empty <h2> heading · ×5
  • Empty <h2> heading apps/readium-web-poc/src/main.ts:60 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
  • Empty <h2> heading apps/readium-web-poc/src/main.ts:65 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
  • Empty <h2> heading apps/readium-web-poc/src/main.ts:79 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
  • Empty <h2> heading apps/readium-web-poc/src/main.ts:86 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
  • Empty <h2> heading apps/readium-web-poc/src/main.ts:91 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: process_import_task.py ↔ source_tree_repository.py apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1 — `apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py` and `apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py` change together 73% of the time (8 of the 11 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 8 shared commits counted here, the most recent 3 are `08afade8` fix(imports): finish book metadata after partial resource failures; `1257f3d0` perf(imports): batch scan writes and preserve resource import intent; `ffda2da2` feat(imports): finalize audio directories once per resource — run `git show` on any of them.
  • Change coupling: ports.py ↔ source_tree_repository.py apps/api-python/app/modules/imports/application/readable_resource/ports.py:1 — `apps/api-python/app/modules/imports/application/readable_resource/ports.py` and `apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py` change together 64% of the time (7 of the 11 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 7 shared commits counted here, the most recent 3 are `08afade8` fix(imports): finish book metadata after partial resource failures; `1257f3d0` perf(imports): batch scan writes and preserve resource import intent; `ffda2da2` feat(imports): finalize audio directories once per resource — run `git show` on any of them.
  • Change coupling: process_import_task.py ↔ scan_source_tree.py apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1 — `apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py` and `apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `a9f771dc` feat(diagnostics): persist and surface backend exception details; `02c4988d` test(imports): verify resource pipeline and retire asset dispatch [sk…; `1257f3d0` perf(imports): batch scan writes and preserve resource import intent — run `git show` on any of them.
  • Change coupling: scan_source_tree.py ↔ task_queue.py apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1 — `apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py` and `apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py` change together 50% of the time (7 of the 14 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 7 shared commits counted here, the most recent 3 are `02932cd0` fix(imports): close scan gap upgrade, narrowing and waiting gaps; `6fd3c638` fix(imports): make scan readiness durable and scoped; `4d8f8319` fix(imports): scope scan failures to dependent tasks — run `git show` on any of them.
  • Change coupling: REDACTED ↔ metadata-lookup-modal.tsx REDACTED:1 — `REDACTED` and `apps/web/features/books/metadata-lookup-modal.tsx` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `e11555e2` fix(metadata): fetch details after final candidate selection [skip ci]; `132e2c14` fix(metadata): honor manual queries and reject conflicting authors [s…; `aa202f58` feat(metadata): correct title and author with AI identity [skip ci] — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×5
  • Edited copy of a member (20 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioComposition.swift:393 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioComposition.swift:393-412 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderProgressStore.swift:74-95 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:263 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:263-283 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:294-313 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) apps/api-python/app/modules/organize/presentation/http.py:413 — apps/api-python/app/modules/organize/presentation/http.py:413-438 | apps/api-python/app/modules/organize/presentation/http.py:451-470 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) apps/api-python/app/modules/library/presentation/http.py:666 — apps/api-python/app/modules/library/presentation/http.py:666-685 | apps/api-python/app/modules/library/presentation/http.py:698-717 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) apps/api-python/app/modules/shelf/presentation/http.py:496 — apps/api-python/app/modules/shelf/presentation/http.py:496-515 | apps/api-python/app/modules/shelf/presentation/http.py:524-543 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×5
  • Edited copy of a member (5 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:29 — apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:29-33 | apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:35-39 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:251 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:251-260 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:261-265 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Persistence/AuthenticatedCoverCache.swift:68 — apps/mobile/iosApp/ErmaoLibrary/Persistence/AuthenticatedCoverCache.swift:68-72 | apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:128-132 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:429 — apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:429-433 | REDACTED:140-145 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:65 — apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:65-69 | apps/api-python/app/modules/reader/infrastructure/v5_repository.py:134-138 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×5
  • Edited copy of a member (4 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:292 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:292-296 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:119-122 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) apps/api-python/app/modules/backup/infrastructure/persistence.py:174 — apps/api-python/app/modules/backup/infrastructure/persistence.py:174-177 | apps/api-python/app/modules/download/infrastructure/tasks.py:19-25 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) apps/api-python/app/api/deps.py:21 — apps/api-python/app/api/deps.py:21-24 | apps/api-python/app/modules/kindle/presentation/http.py:79-82 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) apps/api-python/app/contracts/bibliographic_identity.py:10 — apps/api-python/app/contracts/bibliographic_identity.py:10-15 | REDACTED:113-116 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:414 — apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:414-417 | apps/api-python/app/services/audio_metadata.py:803-806 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×5
  • Edited copy of a member (3 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:357 — apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:357-362 | apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:245-247 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:564 — apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:564-571 | apps/mobile/iosApp/ErmaoLibrary/Application/SharedContentClient.swift:438-440 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosManagedPublicationStore.swift:392 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosManagedPublicationStore.swift:392-394 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:124-127 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AndroidDownloadCatalog.kt:181 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/infrastructure/AndroidDownloadCatalog.kt:181-183 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/platform/persistence/AndroidCoverCache.kt:127-129 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) apps/api-python/app/bootstrap/download.py:166 — apps/api-python/app/bootstrap/download.py:166-169 | apps/api-python/app/modules/download/infrastructure/tasks.py:104-106 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1823 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1823-1840 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:140-157 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1823` 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) apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:98 — apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:98-115 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:182-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:167 — apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:167-184 | apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:287-304 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.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. 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 (18 lines × 2) apps/api-python/app/modules/library/presentation/http.py:1356 — apps/api-python/app/modules/library/presentation/http.py:1356-1373 | apps/api-python/app/modules/library/presentation/http.py:1421-1438 — both copies are in the same file, so extract the 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 (18 lines × 2) apps/api-python/app/modules/system/infrastructure/queue_runtime.py:166 — apps/api-python/app/modules/system/infrastructure/queue_runtime.py:166-183 | apps/api-python/app/modules/system/infrastructure/queue_runtime.py:197-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×5
  • Duplicated block (16 lines × 2) apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:87 — apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:87-102 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:132-147 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) apps/api-python/app/modules/automation/application/file_moves.py:77 — apps/api-python/app/modules/automation/application/file_moves.py:77-92 | apps/api-python/app/modules/automation/application/writebacks.py:125-140 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) apps/api-python/app/modules/automation/presentation/mcp.py:275 — apps/api-python/app/modules/automation/presentation/mcp.py:275-290 | apps/api-python/app/modules/automation/presentation/mcp.py:297-312 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/automation/presentation/mcp.py:275` 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) apps/api-python/app/services/download_queue.py:97 — apps/api-python/app/services/download_queue.py:97-112 | apps/api-python/app/services/kindle_queue.py:480-495 — before extracting anything, compare `apps/api-python/app/services/download_queue.py` and `apps/api-python/app/services/kindle_queue.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/services/download_queue.py:97` 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 (16 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:378 — apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:378-393 | apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:277-292 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:378` 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 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 × 2) · ×5
  • Duplicated block (14 lines × 2) apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:28 — apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:28-41 | apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py:29-42 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py` and `apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (14 lines × 2) apps/api-python/app/modules/kindle/infrastructure/tasks.py:352 — apps/api-python/app/modules/kindle/infrastructure/tasks.py:352-365 | apps/api-python/app/modules/kindle/infrastructure/tasks.py:395-408 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/kindle/infrastructure/tasks.py:352` 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 (14 lines × 2) REDACTED:211 — REDACTED:211-224 | apps/api-python/app/modules/publications/infrastructure/txt_adapter.py:96-109 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from 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 (14 lines × 2) apps/api-python/app/modules/shelf/presentation/http.py:647 — apps/api-python/app/modules/shelf/presentation/http.py:647-660 | apps/api-python/app/modules/shelf/presentation/http.py:789-802 — both copies are in the same file, so extract the 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 (14 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:602 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:602-615 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:536-549 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×5
  • Duplicated block (13 lines × 2) apps/api-python/app/modules/download/presentation/http.py:71 — apps/api-python/app/modules/download/presentation/http.py:71-83 | apps/api-python/app/modules/imports/presentation/path_helpers.py:29-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) apps/api-python/app/modules/organize/presentation/http.py:426 — apps/api-python/app/modules/organize/presentation/http.py:426-438 | apps/api-python/app/modules/organize/presentation/http.py:458-470 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/organize/presentation/http.py:426` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) REDACTED:106 — REDACTED:106-118 | REDACTED:162-174 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (13 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/CbzReadiumPublicationFactory.kt:46 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/CbzReadiumPublicationFactory.kt:46-58 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:75-87 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/CbzReadiumPublicationFactory.kt:46` 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) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:690 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:690-702 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:883-895 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:690` 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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×5
  • Duplicated block (15 lines × 2 locations) apps/web/features/books/book-detail-page.tsx:262 — apps/web/features/books/book-detail-page.tsx:262 · apps/web/features/import-tasks/import-tasks-page.tsx:182 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) apps/web/features/reader/v3/original-publication/chapter-core.ts:57 — apps/web/features/reader/v3/original-publication/chapter-core.ts:57 · apps/web/features/reader/v3/original-publication/mobi-core.worker.ts:26 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (15 lines × 2 locations) apps/web/features/reader/v3/security/epub-archive-safety.ts:26 — apps/web/features/reader/v3/security/epub-archive-safety.ts:26 · apps/web/features/reader/v3/security/epub-archive-safety.ts:42 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2 locations) apps/web/features/settings/settings-page.tsx:140 — apps/web/features/settings/settings-page.tsx:140 · apps/web/features/settings/settings-page.tsx:246 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (15 lines × 2 locations) scripts/verify-python-backend-migration.mjs:21 — scripts/verify-python-backend-migration.mjs:21 · scripts/verify-python-backend-migration.mjs:37 — both copies are in the same file, so extract the 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 · Edited copy of a member (23 corresponding lines) · ×4
  • Edited copy of a member (23 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:744 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:744-766 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:901-927 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) apps/api-python/app/modules/imports/presentation/writes.py:346 — apps/api-python/app/modules/imports/presentation/writes.py:346-368 | apps/api-python/app/modules/imports/presentation/writes.py:385-415 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) apps/api-python/app/modules/reader/presentation/v5.py:756 — apps/api-python/app/modules/reader/presentation/v5.py:756-778 | apps/api-python/app/modules/reader/presentation/v5.py:800-833 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:36 — apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:36-58 | apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:109-132 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×4
  • Edited copy of a member (19 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiCore.swift:167 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiCore.swift:167-202 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiCore.swift:243-261 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:331 — apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:331-350 | apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:356-374 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) apps/api-python/app/modules/automation/presentation/http.py:113 — apps/api-python/app/modules/automation/presentation/http.py:113-134 | apps/api-python/app/modules/automation/presentation/http.py:145-163 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioComposition.swift:209 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioComposition.swift:209-227 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioComposition.swift:229-247 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×4
  • Duplicated block (17 lines × 2) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1051 — apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1051-1067 | apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1241-1257 — both copies are in the same file, so extract the block into 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:52 — REDACTED:52-68 | apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:373-389 — 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) apps/api-python/app/modules/reader/presentation/v5.py:867 — apps/api-python/app/modules/reader/presentation/v5.py:867-883 | apps/api-python/app/modules/reader/presentation/v5.py:922-938 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/reader/presentation/v5.py:867` 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 (17 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt:79 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt:79-95 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsModels.kt:89-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt:79` 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.
D5 · Coupling · Off the main sequence · ×4
  • Off the main sequence: :archiveCore — :archiveCore: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: :chapterCore — :chapterCore: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: @shuku/reader-core — @shuku/reader-core: abstractness 0.11, instability 0.00, distance 0.89 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
  • Off the main sequence: :pdfiumNative — :pdfiumNative: abstractness 0.25, instability 0.00, distance 0.75 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
AC6 · Visual & motion safety · Low contrast Tailwind colour pair (4.4 · ×3
  • Low contrast Tailwind colour pair (4.4:1) apps/web/components/ui/context-action-menu.tsx:148 — This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
  • Low contrast Tailwind colour pair (4.4:1) apps/web/components/ui/feedback.tsx:121 — This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
  • Low contrast Tailwind colour pair (4.4:1) apps/web/features/books/kindle-send-modal.tsx:114 — This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×3
  • Change-coupling hub: schemas.py → REDACTED, client.ts, metadata-lookup-modal.tsx apps/api-python/app/modules/library/presentation/schemas.py — `apps/api-python/app/modules/library/presentation/schemas.py` changes together with 3 other files — `REDACTED`, `apps/web/features/books/api/client.ts`, `apps/web/features/books/metadata-lookup-modal.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: source_node_recognition.py → REDACTED, schemas.py, REDACTED, REDACTED, client.ts, metadata-lookup-modal.tsx apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py — `apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py` changes together with 6 other files — `apps/api-python/app/modules/library/presentation/http.py`, `apps/api-python/app/modules/library/presentation/schemas.py`, `REDACTED`, `REDACTED`, `apps/web/features/books/api/client.ts`, `apps/web/features/books/metadata-lookup-modal.tsx` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 6.
  • Change-coupling hub: REDACTED → REDACTED, client.ts, metadata-lookup-modal.tsx apps/api-python/app/modules/library/presentation/http.py — `apps/api-python/app/modules/library/presentation/http.py` changes together with 3 other files — `REDACTED`, `apps/web/features/books/api/client.ts`, `apps/web/features/books/metadata-lookup-modal.tsx` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×3
  • Edited copy of a member (31 corresponding lines) apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:175 — apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:175-205 | apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:221-251 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) apps/api-python/app/modules/kindle/presentation/http.py:474 — apps/api-python/app/modules/kindle/presentation/http.py:474-504 | apps/api-python/app/modules/kindle/presentation/http.py:514-550 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) apps/api-python/app/modules/automation/application/operations.py:27 — apps/api-python/app/modules/automation/application/operations.py:27-57 | apps/api-python/app/modules/automation/application/operations.py:60-90 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×3
  • Edited copy of a member (36 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:160 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:160-205 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:217-252 — 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.
  • Edited copy of a member (36 corresponding lines) REDACTED:272 — REDACTED:272-307 | REDACTED:409-447 — 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.
  • Edited copy of a member (36 corresponding lines) apps/api-python/app/modules/reader/presentation/v5.py:855 — apps/api-python/app/modules/reader/presentation/v5.py:855-890 | apps/api-python/app/modules/reader/presentation/v5.py:911-949 — 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 (27 corresponding lines) · ×3
  • Edited copy of a member (27 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:274 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:274-304 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:237-263 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) apps/api-python/app/modules/automation/application/file_moves.py:65 — apps/api-python/app/modules/automation/application/file_moves.py:65-92 | apps/api-python/app/modules/automation/application/writebacks.py:114-140 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) apps/api-python/app/modules/library/presentation/http.py:1839 — apps/api-python/app/modules/library/presentation/http.py:1839-1865 | apps/api-python/app/modules/library/presentation/http.py:1879-1908 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×3
  • Edited copy of a member (28 corresponding lines) apps/api-python/app/infrastructure/copied_file_attributes.py:35 — apps/api-python/app/infrastructure/copied_file_attributes.py:35-72 | apps/api-python/app/infrastructure/copied_file_attributes.py:76-103 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:37 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:37-64 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageActions.kt:75-102 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:939 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:939-974 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:532-559 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×3
  • Edited copy of a member (24 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:41 — apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:41-77 | apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:42-65 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) apps/api-python/app/modules/download/presentation/http.py:58 — apps/api-python/app/modules/download/presentation/http.py:58-83 | apps/api-python/app/modules/imports/presentation/path_helpers.py:18-41 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) apps/api-python/app/modules/auth/presentation/users.py:239 — apps/api-python/app/modules/auth/presentation/users.py:239-262 | apps/api-python/app/modules/auth/presentation/users.py:282-306 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×3
  • Edited copy of a member (29 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:687 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/infrastructure/KtorAdministrativeSettingsRepository.kt:687-715 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/personalsettings/infrastructure/KtorPersonalSettingsRepository.kt:349-380 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) apps/api-python/app/modules/media/infrastructure/resource_repository.py:33 — apps/api-python/app/modules/media/infrastructure/resource_repository.py:33-61 | apps/api-python/app/modules/media/infrastructure/resource_repository.py:64-100 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) apps/api-python/app/modules/system/infrastructure/queue_runtime.py:150 — apps/api-python/app/modules/system/infrastructure/queue_runtime.py:150-183 | apps/api-python/app/modules/system/infrastructure/queue_runtime.py:186-214 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×3
  • Edited copy of a member (16 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:566 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:566-588 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:515-530 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) apps/api-python/app/services/log_maintenance.py:103 — apps/api-python/app/services/log_maintenance.py:103-118 | apps/api-python/app/services/log_maintenance.py:121-137 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeLibraryScreens.kt:390 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeLibraryScreens.kt:390-405 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:107-123 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×3
  • Edited copy of a member (21 corresponding lines) apps/api-python/app/modules/updates/presentation/http.py:115 — apps/api-python/app/modules/updates/presentation/http.py:115-135 | apps/api-python/app/modules/updates/presentation/http.py:158-183 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) apps/api-python/app/modules/reader/application/resource_reader.py:279 — apps/api-python/app/modules/reader/application/resource_reader.py:279-300 | apps/api-python/app/modules/reader/application/resource_reader.py:392-412 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) scripts/python_backend_sample_smoke.py:126 — scripts/python_backend_sample_smoke.py:126-148 | scripts/python_release_live_fixture.py:573-593 — 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 (6 corresponding lines) · ×3
  • Edited copy of a member (6 corresponding lines) apps/api-python/app/modules/library/infrastructure/automation_access.py:31 — apps/api-python/app/modules/library/infrastructure/automation_access.py:31-40 | apps/api-python/app/modules/library/infrastructure/filter_options.py:55-60 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:167 — apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:167-172 | apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/SharedManagedDownloadTransfer.swift:173-181 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) apps/api-python/app/db/session.py:62 — apps/api-python/app/db/session.py:62-67 | apps/api-python/app/modules/imports/infrastructure/readable_resource/support.py:73-78 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (2 corresponding lines) · ×3
  • Edited copy of a member (2 corresponding lines) apps/api-python/app/modules/download/infrastructure/tasks.py:156 — apps/api-python/app/modules/download/infrastructure/tasks.py:156-157 | apps/api-python/app/modules/imports/infrastructure/library_queries.py:67-72 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (2 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/domain/Downloads.kt:384 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/domain/Downloads.kt:384-385 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:374-375 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (2 corresponding lines) REDACTED:34 — REDACTED:34-35 | REDACTED:79-80 — These two members are one piece of code written twice and then edited apart: 2 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 (14 lines × 3) · ×3
  • Duplicated block (14 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:235 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:235-248 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:310-323 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:412-425 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:235` 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) apps/api-python/app/modules/download/presentation/http.py:95 — apps/api-python/app/modules/download/presentation/http.py:95-108 | apps/api-python/app/modules/organize/presentation/http.py:66-79 | apps/api-python/app/modules/shelf/presentation/http.py:102-115 — 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 (14 lines × 3) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:131 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:131-144 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:321-334 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:423-436 — 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:131` 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 (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:914 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:914-925 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1061-1072 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1074-1085 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:914` 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) apps/api-python/app/modules/download/infrastructure/download_http.py:26 — apps/api-python/app/modules/download/infrastructure/download_http.py:26-37 | apps/api-python/app/modules/download/infrastructure/download_http.py:55-66 | apps/api-python/app/modules/download/infrastructure/download_http.py:72-83 — 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 (12 lines × 3) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:51 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:51-62 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderView.swift:53-64 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:52-63 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:51` 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 × 3) · ×3
  • Duplicated block (11 lines × 3) apps/api-python/app/modules/kindle/presentation/http.py:474 — apps/api-python/app/modules/kindle/presentation/http.py:474-484 | apps/api-python/app/modules/kindle/presentation/http.py:514-524 | apps/api-python/app/modules/kindle/presentation/http.py:560-570 — 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) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:147 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:147-159 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:167-177 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:203-213 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:147` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:166` calls `sanitizeMarkup` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:147` 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 × 3) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:241 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:241-251 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1070-1080 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:208-218 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684-690 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:870-876 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1074-1080 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1101-1107 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:682` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1073` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:744 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:744-750 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:869-875 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1099-1106 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2006-2012 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1099` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:867` calls `Column`, `Boolean` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:743` 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 (7 lines × 4) apps/api-python/app/modules/library/infrastructure/book_list.py:276 — apps/api-python/app/modules/library/infrastructure/book_list.py:276-284 | apps/api-python/app/modules/library/infrastructure/books.py:287-295 | REDACTED:56-62 | REDACTED:162-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 all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/library/infrastructure/book_list.py:276` 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 after the matched lines, `apps/api-python/app/modules/library/infrastructure/book_list.py:287` calls `asc` and `apps/api-python/app/modules/library/infrastructure/books.py:298` 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 × 3) · ×3
  • Duplicated block (6 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:673 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:673-679 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1108-1113 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1218-1224 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:673` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1227` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1116` 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 × 3) apps/api-python/app/db/alembic/versions/0054_resource_filter_cover_index.py:14 — apps/api-python/app/db/alembic/versions/0054_resource_filter_cover_index.py:14-19 | apps/api-python/app/db/alembic/versions/0055_resource_book_summary_cover.py:14-19 | apps/api-python/app/db/alembic/versions/0056_resource_identity_cover.py:14-19 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:630 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:630-635 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:997-1002 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:561-566 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) apps/api-python/app/modules/reader/infrastructure/resource_repository.py:126 — apps/api-python/app/modules/reader/infrastructure/resource_repository.py:126-132 | apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:369-375 | apps/api-python/app/modules/reader/infrastructure/v5_repository.py:182-188 — 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 (7 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1124 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1124-1130 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1150-1156 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1177-1183 — 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, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1131` calls `requireNotNull` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:1184` 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 (7 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:495 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:495-501 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:989-995 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:467-473 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:235 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:235-253 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:178-196 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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 (19 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:365 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:365-383 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:371-389 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt: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.
  • Duplicated block (19 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:166 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:166-184 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:221-239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:166` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:185` calls `takeIf` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageSettings.kt:240` 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 (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:361 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:361-369 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:464-471 — both copies are in the same file, so extract the 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:361` 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 (8–9 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:50 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:50-57 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:56-64 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift` as WHOLE FILES: this scan already matched 6 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. 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 × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:435 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:435-442 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:487-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
AC2 · Forms & labels · <Combobox> field component without a label · ×2
  • <Combobox> field component without a label apps/web/features/library/async-filter-value-editor.tsx:63 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
  • <Combobox> field component without a label apps/web/features/library/smart-filter-builder.tsx:162 — This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×2
  • Animation without a prefers-reduced-motion guard prototypes/feedback-web/prototype.css:10 — `.spinner` moves (`animation: spin .75s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard apps/web/app/globals.css:604 — `.shuku-loading-panel::after` moves (`animation: shuku-loading-spin 0.85s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
D2 · Cognitive Complexity · reader-safety-policy.rewriteReferences · ×2
  • reader-safety-policy.rewriteReferences::expandEntity (cognitive 36) apps/web/features/reader/v3/security/reader-safety-policy.ts:286 — reader-safety-policy.rewriteReferences::expandEntity has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (reader-safety-policy.rewriteReferences, reader-safety-policy.rewriteReferences::appendEscaped) 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.
  • reader-safety-policy.rewriteReferences::appendEscaped (cognitive 26) apps/web/features/reader/v3/security/reader-safety-policy.ts:260 — reader-safety-policy.rewriteReferences::appendEscaped has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (20 pts), if/else 3 (5 pts), loops 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 2 other methods here (reader-safety-policy.rewriteReferences, reader-safety-policy.rewriteReferences::expandEntity) 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 · book-detail-page.BookDetailPage · ×2
  • book-detail-page.BookDetailPage::invokeSourceNodeAction (cognitive 21) apps/web/features/books/book-detail-page.tsx:573 — book-detail-page.BookDetailPage::invokeSourceNodeAction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (book-detail-page.BookDetailPage, book-detail-page.BookDetailPage::invokeResourceAction) 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.
  • book-detail-page.BookDetailPage::invokeResourceAction (cognitive 17) apps/web/features/books/book-detail-page.tsx:516 — book-detail-page.BookDetailPage::invokeResourceAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, ternaries 1 (2 pts), error handling 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. This shape REPEATS in the file: 2 other methods here (book-detail-page.BookDetailPage, book-detail-page.BookDetailPage::invokeSourceNodeAction) 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 · shelves-page.ShelvesPage · ×2
  • shelves-page.ShelvesPage::saveShelf (cognitive 20) apps/web/features/shelves/shelves-page.tsx:471 — shelves-page.ShelvesPage::saveShelf has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 2, 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. This shape REPEATS in the file: 2 other methods here (shelves-page.ShelvesPage, shelves-page.ShelvesPage::openShelf) 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.
  • shelves-page.ShelvesPage::openShelf (cognitive 17) apps/web/features/shelves/shelves-page.tsx:371 — shelves-page.ShelvesPage::openShelf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 3, error handling 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. This shape REPEATS in the file: 2 other methods here (shelves-page.ShelvesPage, shelves-page.ShelvesPage::saveShelf) 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.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (4 members, 50+ identical tokens) apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:13 — apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:13-63 | apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py:13-59 | apps/api-python/app/db/alembic/versions/0027_automation_uploads.py:13-34 | apps/api-python/app/db/alembic/versions/0029_file_deletions.py:13-21 — 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) apps/api-python/app/modules/library/infrastructure/book_list.py:274 — apps/api-python/app/modules/library/infrastructure/book_list.py:274-293 | apps/api-python/app/modules/library/infrastructure/books.py:283-302 | REDACTED:41-78 | REDACTED:144-258 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×2
  • Edited copy of a member (22 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:60 — apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:60-81 | apps/mobile/iosApp/ErmaoLibrary/Persistence/KeychainCookiePayloadStore.swift:134-157 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:123 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:123-146 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/components/WarmPageFeedback.kt:152-173 — 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 copies of one member (3 members, 20+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 20+ corresponding lines) apps/api-python/app/infrastructure/opds_runtime.py:689 — apps/api-python/app/infrastructure/opds_runtime.py:689-711 | apps/api-python/app/modules/media/presentation/http.py:124-143 | apps/api-python/app/modules/media/presentation/http.py:166-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) REDACTED:99 — REDACTED:99-118 | REDACTED:155-177 | REDACTED:140-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 17+ corresponding lines) apps/api-python/app/modules/library/presentation/http.py:570 — apps/api-python/app/modules/library/presentation/http.py:570-592 | apps/api-python/app/modules/library/presentation/http.py:730-747 | apps/api-python/app/modules/library/presentation/http.py:760-776 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) apps/api-python/app/modules/organize/presentation/http.py:207 — apps/api-python/app/modules/organize/presentation/http.py:207-223 | apps/api-python/app/modules/organize/presentation/http.py:233-251 | apps/api-python/app/modules/organize/presentation/http.py:260-276 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×2
  • Edited copy of a member (11 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:269 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:269-279 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosTxtPublicationFactory.swift:218-228 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:225 — apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:225-235 | apps/mobile/iosApp/ErmaoLibrary/Features/Me/SettingsComponents.swift:237-247 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 8+ corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBookmarkSyncPort.kt:83 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBookmarkSyncPort.kt:83-94 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:343-350 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderPositionSyncPort.kt:100-110 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) REDACTED:35 — REDACTED:35-42 | apps/api-python/app/modules/library/infrastructure/legacy_views.py:56-66 | apps/api-python/app/modules/media/presentation/http.py:82-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 7+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:19 — apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:19-39 | apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:16-40 | apps/mobile/iosApp/ErmaoLibrary/Features/Library/LibraryView.swift:18-38 | apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/ShelfCatalogView.swift:18-24 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:187 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:187-196 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MessagingSettingsViews.swift:197-206 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:240-250 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:352-358 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 13+ corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:82 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:82-94 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:230-245 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:250-262 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:267-283 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 13+ corresponding lines) REDACTED:691 — REDACTED:691-707 | REDACTED:661-679 | apps/api-python/app/modules/publications/infrastructure/mobi_adapter.py:605-617 | apps/api-python/app/modules/publications/infrastructure/txt_adapter.py:214-232 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) apps/api-python/app/modules/backup/presentation/http.py:118 — apps/api-python/app/modules/backup/presentation/http.py:118-127 | apps/api-python/app/modules/backup/presentation/http.py:137-148 | apps/api-python/app/modules/backup/presentation/http.py:184-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) apps/api-python/app/modules/library/application/recognized_metadata.py:365 — apps/api-python/app/modules/library/application/recognized_metadata.py:365-374 | apps/api-python/app/modules/library/domain/facets.py:37-46 | REDACTED:50-59 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) apps/api-python/app/modules/library/infrastructure/resource_cover.py:63 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:63-85 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:39-61 — before extracting anything, compare `apps/api-python/app/modules/library/infrastructure/resource_cover.py` and `apps/api-python/app/modules/library/infrastructure/source_node_cover.py` as WHOLE FILES: this scan already matched 5 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.
  • Duplicated block (23 lines × 2) apps/api-python/app/modules/media/infrastructure/resource_repository.py:33 — apps/api-python/app/modules/media/infrastructure/resource_repository.py:33-55 | apps/api-python/app/modules/media/infrastructure/resource_repository.py:64-86 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/media/infrastructure/resource_repository.py:33` 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–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:270 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:270-284 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:371-386 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:370` calls `Index` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:270` 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 (15–16 lines × 2) scripts/accept_dependency_preparation.py:120 — scripts/accept_dependency_preparation.py:120-134 | scripts/container_update_fixture.py:271-286 — 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 `scripts/accept_dependency_preparation.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.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629-640 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:981-990 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) apps/api-python/app/modules/kindle/presentation/http.py:387 — apps/api-python/app/modules/kindle/presentation/http.py:387-396 | apps/api-python/app/modules/kindle/presentation/http.py:450-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) apps/api-python/app/modules/automation/application/writes.py:527 — apps/api-python/app/modules/automation/application/writes.py:527-537 | apps/api-python/app/modules/automation/application/writes.py:561-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/automation/application/writes.py:561` 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–12 lines × 2) apps/api-python/app/modules/reader/application/resource_reader_v5.py:207 — apps/api-python/app/modules/reader/application/resource_reader_v5.py:207-218 | apps/api-python/app/modules/reader/application/resource_reader_v5.py:279-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×2
  • Duplicated block (9 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:979 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:979-987 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2087-2095 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2178-2186 — 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2187` calls `Column`, `BigInteger` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2096` 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 × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:182 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:182-190 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:195-203 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:876-885 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt: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 (8 lines × 5) · ×2
  • Duplicated block (8 lines × 5) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629-636 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:914-921 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:938-945 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:981-988 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1061-1068 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:946` calls `UniqueConstraint` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:637` 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 × 5) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:804 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:804-811 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1073-1080 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1184-1191 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1451-1458 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1473-1480 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1181` calls `Column`, `String` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1071` 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 × 3) · ×2
  • Duplicated block (8 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684-691 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:938-945 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1101-1108 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684-691 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1074-1081 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1101-1108 — 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:682` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1073` 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 × 7) · ×2
  • Duplicated block (7 lines × 7) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:684-690 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:870-876 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1101-1107 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1233-1239 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1396-1402 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1930-1937 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2007-2013 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1930` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1231` calls `Column`, `Text`, `Boolean` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1930` 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 (7 lines × 7) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:765 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:765-771 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1329-1335 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1353-1359 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1427-1433 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1545-1551 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1580-1586 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:129-135 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1587` calls `Column`, `BigInteger` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:772` 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 (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1110 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1110-1114 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1221-1225 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1644-1649 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1227` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1116` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476-480 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSystemScreens.kt:251-255 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSystemScreens.kt:477-481 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:476` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) apps/api-python/app/modules/auth/application/commands.py:10 — apps/api-python/app/modules/auth/application/commands.py:10-39 | apps/api-python/app/modules/system/application/commands.py:10-45 — 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. 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 (30 lines × 2) scripts/python_release_load_precheck.py:2363 — scripts/python_release_load_precheck.py:2363-2392 | scripts/python_release_load_precheck.py:2437-2466 — both copies are in the same file, so extract the 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 `scripts/python_release_load_precheck.py:2363` 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 × 2) · ×2
  • Duplicated block (24 lines × 2) apps/api-python/app/modules/kindle/application/commands.py:8 — apps/api-python/app/modules/kindle/application/commands.py:8-31 | apps/api-python/app/modules/metadata/application/commands.py:10-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.
  • Duplicated block (24 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:19 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:19-42 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:19-42 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:19` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:43` calls `applySavedZoomAfterPresentation` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:43` 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 (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) apps/api-python/app/services/default_cover_cleanup.py:73 — apps/api-python/app/services/default_cover_cleanup.py:73-77 | apps/mobile/native/pdfium/scripts/verify-lock.py:16-20 | scripts/prepare-public-domain-format-library.py:176-180 | scripts/python_backend_sample_smoke.py:75-79 | scripts/python_reader_position_acceptance_smoke.py:395-399 — 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.
  • Duplicated block (5 lines × 5) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/auth/LoginScreen.kt:314 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/auth/LoginScreen.kt:314-318 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:243-247 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:261-265 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerCenterScreen.kt:276-280 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:285-291 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/auth/LoginScreen.kt:314` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:233 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:233-248 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:377-392 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:176-191 — before extracting anything, compare `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt` and `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt` as WHOLE FILES: this scan already matched 6 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:233` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 3) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:381 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:381-396 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:478-493 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:560-575 — 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 `apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:381` 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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×2
  • Outbound HTTP without resilience apps/mobile/shared/src/androidMain/kotlin/com/ermao/library/shared/core/network/PlatformHttpClient.android.kt:20 — `HttpClient(` 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.
  • Outbound HTTP without resilience apps/mobile/shared/src/iosMain/kotlin/com/ermao/library/shared/core/network/PlatformHttpClient.ios.kt:32 — `HttpClient(` 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 (86 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (86 matched lines × 2 locations) apps/web/components/directory/target-directory-picker.tsx:184 — apps/web/components/directory/target-directory-picker.tsx:184 · apps/web/features/settings/ui/directory-path-picker.tsx:162 — the two spans are one implementation copied and then locally edited — 603 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (86 matched lines × 2 locations) apps/web/features/reader/v3/adapters/comic-adapter.ts:215 — apps/web/features/reader/v3/adapters/comic-adapter.ts:215 · apps/web/features/reader/v3/adapters/pdf-adapter.ts:213 — the two spans are one implementation copied and then locally edited — 563 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 (24 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (24 matched lines × 2 locations) apps/web/features/audio/audio-playback-provider.tsx:588 — apps/web/features/audio/audio-playback-provider.tsx:588 · apps/web/features/reader/v3/reader-v3-page.tsx:407 — the two spans are one implementation copied and then locally edited — 183 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (24 matched lines × 2 locations) apps/web/features/reader/reader-shell.tsx:1117 — apps/web/features/reader/reader-shell.tsx:1117 · apps/web/features/reader/reader-shell.tsx:1180 — the two spans are one implementation copied and then locally edited — 188 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (21 lines × 2 locations) · ×2
  • Duplicated block (21 lines × 2 locations) apps/web/features/organize/classification-management-panel.tsx:169 — apps/web/features/organize/classification-management-panel.tsx:169 · apps/web/features/organize/organize-page.tsx:415 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (21 lines × 2 locations) apps/web/features/reader/v3/adapters/readium-publication.ts:377 — apps/web/features/reader/v3/adapters/readium-publication.ts:377 · apps/web/features/reader/v3/adapters/readium-publication.ts:401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×2
  • Duplicated block (20 lines × 2 locations) apps/web/scripts/build-mobi-wasm.mjs:23 — apps/web/scripts/build-mobi-wasm.mjs:23 · apps/web/scripts/verify-mobi-wasm.mjs:9 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (20 lines × 2 locations) apps/web/scripts/verify-chapters-wasm.mjs:15 — apps/web/scripts/verify-chapters-wasm.mjs:15 · apps/web/scripts/verify-mobi-wasm.mjs:9 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Duplicated block with local edits (16 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (16 matched lines × 2 locations) apps/web/features/books/metadata-lookup-modal.tsx:127 — apps/web/features/books/metadata-lookup-modal.tsx:127 · apps/web/features/books/ui/source-node-metadata-dialogs.tsx:107 — the two spans are one implementation copied and then locally edited — 106 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (16 matched lines × 2 locations) apps/web/features/reader/v3/paged-track/paged-track-controller.ts:505 — apps/web/features/reader/v3/paged-track/paged-track-controller.ts:505 · apps/web/features/reader/v3/paged-track/paged-track-controller.ts:529 — the two spans are one implementation copied and then locally edited — 96 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (14 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (14 matched lines × 2 locations) apps/web/features/import-tasks/api/client.ts:52 — apps/web/features/import-tasks/api/client.ts:52 · apps/web/features/library/api/filtering.ts:7 — the two spans are one implementation copied and then locally edited — 104 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (14 matched lines × 2 locations) apps/web/features/management/management-logs-page.tsx:317 — apps/web/features/management/management-logs-page.tsx:317 · apps/web/features/management/management-logs-page.tsx:358 — the two spans are one implementation copied and then locally edited — 219 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×2
  • Duplicated block (13 lines × 2 locations) apps/web/features/books/book-detail-page.tsx:159 — apps/web/features/books/book-detail-page.tsx:159 · apps/web/features/books/ui/source-node-metadata-dialogs.tsx:62 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) apps/web/features/dashboard/api/dashboard.ts:30 — apps/web/features/dashboard/api/dashboard.ts:30 · apps/web/features/management/api/overview.ts:62 — 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.
AC2 · Forms & labels · <fieldset> without a <legend> · ×1
  • <fieldset> without a <legend> REDACTED:269 — A fieldset groups related controls but has no <legend> to name the group. Add a <legend> as its first child — or, if the group already has a visible caption beside it (or the fieldset is there only to disable its subtree and carries no group box), point aria-labelledby at that caption's id instead, which names the group without rendering a second one.
AC3 · Page structure · Empty <h1> heading · ×1
  • Empty <h1> heading apps/readium-web-poc/src/main.ts:30 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
AC6 · Visual & motion safety · Low contrast Tailwind colour pair (3.8 · ×1
  • Low contrast Tailwind colour pair (3.8:1) apps/web/features/books/ui/book-content-browser.tsx:60 — This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.1 · ×1
  • Low contrast colour pair in CSS (3.1:1) prototypes/feedback-web/prototype.css:12 — `.mobile-nav button.active` sets color: #ed4d2d on background-color: #fce5de — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.7 · ×1
  • Low contrast colour pair in CSS (3.7:1) prototypes/feedback-web/prototype.css:14 — `.editor-tools button:hover` sets color: #d94322 on background-color: #f0e9e4 — 3.7:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
AC6 · Visual & motion safety · Low contrast colour pair in CSS (4.4 · ×1
  • Low contrast colour pair in CSS (4.4:1) prototypes/feedback-web/prototype.css:14 — `.editor-switch button.active` sets color: #d94322 on background-color: #fff — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.8 · ×1
  • Low contrast colour pair in CSS (3.8:1) prototypes/feedback-web/prototype.css:14 — `.upload-item>img,.upload-file-icon` sets color: #d94322 on background-color: #f4eee9 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. This is a MINIFIED, build-generated sheet — editing the literal here is undone by the next vendor drop or rebuild, so override the rule in your own stylesheet (or fix it upstream / in the source the bundle is built from).
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×1
  • Focus outline removed in CSS without a :focus replacement prototypes/feedback-web/prototype.css:14 — `.markdown-input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D1 · Cyclomatic Complexity · reader-shell.ReaderShell (cyclomatic 225) · ×1
  • reader-shell.ReaderShell (cyclomatic 225) apps/web/features/reader/reader-shell.tsx:250 — reader-shell.ReaderShell has cyclomatic complexity 225 (threshold 15). Of this number, 109 points are the body's own statements and 116 belong to 40 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · audio-playback-provider.AudioPlaybackProvider (cyclomatic 201) · ×1
  • audio-playback-provider.AudioPlaybackProvider (cyclomatic 201) apps/web/features/audio/audio-playback-provider.tsx:166 — audio-playback-provider.AudioPlaybackProvider has cyclomatic complexity 201 (threshold 15). Most of this is not in the body itself: 5 of the 201 points are its own statements and the rest belongs to 58 function literals inside it that branch (lines 337, 400, 821, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · app-shell.AppShell (cyclomatic 186) · ×1
  • app-shell.AppShell (cyclomatic 186) apps/web/components/layout/app-shell.tsx:143 — app-shell.AppShell has cyclomatic complexity 186 (threshold 15). Of this number, 37 points are the body's own statements and 149 belong to 56 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · book-detail-page.BookDetailPage (cyclomatic 156) · ×1
  • book-detail-page.BookDetailPage (cyclomatic 156) apps/web/features/books/book-detail-page.tsx:189 — book-detail-page.BookDetailPage has cyclomatic complexity 156 (threshold 15). Of this number, 58 points are the body's own statements and 98 belong to 32 function items inside it that branch. 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 · generate-reader-safety-policy.validate_policy (cyclomatic 130) · ×1
  • generate-reader-safety-policy.validate_policy (cyclomatic 130) packages/reader-contracts/generate-reader-safety-policy.py:109 — generate-reader-safety-policy.validate_policy has cyclomatic complexity 130 (threshold 15). To reduce it, separate the cases: extract each independent 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 · shelves-page.ShelvesPage (cyclomatic 125) · ×1
  • shelves-page.ShelvesPage (cyclomatic 125) apps/web/features/shelves/shelves-page.tsx:76 — shelves-page.ShelvesPage has cyclomatic complexity 125 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (shelves-page.ShelvesPage::openShelf) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · library-page.LibraryPage (cyclomatic 119) · ×1
  • library-page.LibraryPage (cyclomatic 119) apps/web/features/library/library-page.tsx:75 — library-page.LibraryPage has cyclomatic complexity 119 (threshold 15). Of this number, 50 points are the body's own statements and 69 belong to 32 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update-operations.UpdateOperations (cyclomatic 100) · ×1
  • update-operations.UpdateOperations (cyclomatic 100) apps/web/features/updates/ui/update-operations.tsx:40 — update-operations.UpdateOperations has cyclomatic complexity 100 (threshold 15). Of this number, 84 points are the body's own statements and 16 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · feedback-dialog.FeedbackDialog (cyclomatic 97) · ×1
  • feedback-dialog.FeedbackDialog (cyclomatic 97) REDACTED:71 — feedback-dialog.FeedbackDialog has cyclomatic complexity 97 (threshold 15). Of this number, 35 points are the body's own statements and 62 belong to 21 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · library-batch-actions.LibraryBatchDialog (cyclomatic 94) · ×1
  • library-batch-actions.LibraryBatchDialog (cyclomatic 94) apps/web/features/library/library-batch-actions.tsx:144 — library-batch-actions.LibraryBatchDialog has cyclomatic complexity 94 (threshold 15). Of this number, 50 points are the body's own statements and 44 belong to 20 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · reader-engine-runtime.ReaderEngineRuntime (cyclomatic 89) · ×1
  • reader-engine-runtime.ReaderEngineRuntime (cyclomatic 89) apps/web/features/reader/v3/reader-engine-runtime.tsx:156 — reader-engine-runtime.ReaderEngineRuntime has cyclomatic complexity 89 (threshold 15). Of this number, 16 points are the body's own statements and 73 belong to 27 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MultiDownloadSheetKt.MultiDownloadSheet (cyclomatic 84) · ×1
  • MultiDownloadSheetKt.MultiDownloadSheet (cyclomatic 84) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:99 — MultiDownloadSheetKt.MultiDownloadSheet has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent 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 · ScanLibrarySourceTree._walk (cyclomatic 80) · ×1
  • ScanLibrarySourceTree._walk (cyclomatic 80) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:575 — ScanLibrarySourceTree._walk has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · audio-mini-player.AudioMiniPlayer (cyclomatic 75) · ×1
  • audio-mini-player.AudioMiniPlayer (cyclomatic 75) apps/web/components/audio/audio-mini-player.tsx:42 — audio-mini-player.AudioMiniPlayer has cyclomatic complexity 75 (threshold 15). Of this number, 57 points are the body's own statements and 18 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · settings-page.SettingsPage (cyclomatic 74) · ×1
  • settings-page.SettingsPage (cyclomatic 74) apps/web/features/settings/settings-page.tsx:54 — settings-page.SettingsPage has cyclomatic complexity 74 (threshold 15). Of this number, 17 points are the body's own statements and 57 belong to 20 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProcessReadableResourceImportTask._execute_directory (cyclomatic 73) · ×1
  • ProcessReadableResourceImportTask._execute_directory (cyclomatic 73) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:715 — ProcessReadableResourceImportTask._execute_directory has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent 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 · generate-reader-safety-conformance.evaluateFactCase (cyclomatic 71) · ×1
  • generate-reader-safety-conformance.evaluateFactCase (cyclomatic 71) REDACTED:563 — generate-reader-safety-conformance.evaluateFactCase has cyclomatic complexity 71 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · reader-engine-runtime.readerErrorMessage (cyclomatic 67) · ×1
  • reader-engine-runtime.readerErrorMessage (cyclomatic 67) apps/web/features/reader/v3/reader-engine-runtime.tsx:76 — reader-engine-runtime.readerErrorMessage has cyclomatic complexity 67 (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 · ProviderSourceNodeMetadataRecognition.search (cyclomatic 65) · ×1
  • ProviderSourceNodeMetadataRecognition.search (cyclomatic 65) apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py:48 — ProviderSourceNodeMetadataRecognition.search has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DependencySet.validate_set (cyclomatic 65) · ×1
  • DependencySet.validate_set (cyclomatic 65) apps/api-python/app/modules/updates/application/dependency_release.py:61 — DependencySet.validate_set has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · target-directory-picker.TargetDirectoryPicker (cyclomatic 65) · ×1
  • target-directory-picker.TargetDirectoryPicker (cyclomatic 65) apps/web/components/directory/target-directory-picker.tsx:57 — target-directory-picker.TargetDirectoryPicker has cyclomatic complexity 65 (threshold 15). Of this number, 25 points are the body's own statements and 40 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · metadata_lookup_queue._prepare_candidate_application (cyclomatic 64) · ×1
  • metadata_lookup_queue._prepare_candidate_application (cyclomatic 64) REDACTED:319 — metadata_lookup_queue._prepare_candidate_application has cyclomatic complexity 64 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · reader-v3-page.ReaderV5Page (cyclomatic 62) · ×1
  • reader-v3-page.ReaderV5Page (cyclomatic 62) apps/web/features/reader/v3/reader-v3-page.tsx:228 — reader-v3-page.ReaderV5Page has cyclomatic complexity 62 (threshold 15). Most of this is not in the body itself: 9 of the 62 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 292, 474, 370, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · directory-path-picker.DirectoryPathPicker (cyclomatic 61) · ×1
  • directory-path-picker.DirectoryPathPicker (cyclomatic 61) apps/web/features/settings/ui/directory-path-picker.tsx:13 — directory-path-picker.DirectoryPathPicker has cyclomatic complexity 61 (threshold 15). Of this number, 25 points are the body's own statements and 36 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · metadata-providers-panel.MetadataProvidersPanel (cyclomatic 61) · ×1
  • metadata-providers-panel.MetadataProvidersPanel (cyclomatic 61) apps/web/features/organize/metadata-providers-panel.tsx:62 — metadata-providers-panel.MetadataProvidersPanel has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 10 of the 61 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 234, testProvider, a function literal at line 219, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · metadata_lookup_queue.process_metadata_lookup_task (cyclomatic 60) · ×1
  • metadata_lookup_queue.process_metadata_lookup_task (cyclomatic 60) REDACTED:709 — metadata_lookup_queue.process_metadata_lookup_task 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 · main.main (cyclomatic 60) · ×1
  • main.main (cyclomatic 60) apps/api-python/app/worker/main.py:103 — main.main 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 · users-permissions-page.UsersPermissionsPage (cyclomatic 60) · ×1
  • users-permissions-page.UsersPermissionsPage (cyclomatic 60) apps/web/features/settings/center/users-permissions-page.tsx:88 — users-permissions-page.UsersPermissionsPage has cyclomatic complexity 60 (threshold 15). Of this number, 21 points are the body's own statements and 39 belong to 7 function items inside it that branch. 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 · MainShellKt.MainShell (cyclomatic 58) · ×1
  • MainShellKt.MainShell (cyclomatic 58) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:218 — MainShellKt.MainShell has cyclomatic complexity 58 (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 · readium-publication.openEpub (cyclomatic 57) · ×1
  • readium-publication.openEpub (cyclomatic 57) apps/web/features/reader/v3/adapters/readium-publication.ts:310 — readium-publication.openEpub has cyclomatic complexity 57 (threshold 15). Of this number, 30 points are the body's own statements and 27 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · management-logs-page.ManagementLogsPage (cyclomatic 53) · ×1
  • management-logs-page.ManagementLogsPage (cyclomatic 53) apps/web/features/management/management-logs-page.tsx:99 — management-logs-page.ManagementLogsPage has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 14 of the 53 points are its own statements and the rest belongs to 12 function items inside it that branch (saveLogLimit, a function literal at line 317, a function literal at line 358, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · resource-detail-view.ResourceDetailView (cyclomatic 51) · ×1
  • resource-detail-view.ResourceDetailView (cyclomatic 51) apps/web/features/books/ui/resource-detail-view.tsx:75 — resource-detail-view.ResourceDetailView has cyclomatic complexity 51 (threshold 15). Of this number, 35 points are the body's own statements and 16 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · import-tasks-page.ImportTasksPage (cyclomatic 50) · ×1
  • import-tasks-page.ImportTasksPage (cyclomatic 50) apps/web/features/import-tasks/import-tasks-page.tsx:94 — import-tasks-page.ImportTasksPage has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 15 of the 50 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 143, a function literal at line 317, continueTask, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · pwa-client.PwaClient (cyclomatic 49) · ×1
  • pwa-client.PwaClient (cyclomatic 49) apps/web/components/system/pwa-client.tsx:79 — pwa-client.PwaClient has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 4 of the 49 points are its own statements and the rest belongs to 21 function items inside it that branch (a function literal at line 172, a function literal at line 96, a function literal at line 132, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · BookManagementKt.ManagementPresentation (cyclomatic 47) · ×1
  • BookManagementKt.ManagementPresentation (cyclomatic 47) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/BookManagement.kt:328 — BookManagementKt.ManagementPresentation has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · book-table.BookTable (cyclomatic 47) · ×1
  • book-table.BookTable (cyclomatic 47) apps/web/components/book/book-table.tsx:25 — book-table.BookTable has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 4 of the 47 points are its own statements and the rest belongs to 12 function items inside it that branch (sortableHeader, beginRowSelection, a function literal at line 221, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · setup-page.SetupPage (cyclomatic 47) · ×1
  • setup-page.SetupPage (cyclomatic 47) apps/web/features/settings/setup-page.tsx:37 — setup-page.SetupPage has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 7 of the 47 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 53, createAccount, addLibrary, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · api.fetchReaderBootstrap (cyclomatic 46) · ×1
  • api.fetchReaderBootstrap (cyclomatic 46) apps/web/features/reader/v3/api.ts:255 — api.fetchReaderBootstrap has cyclomatic complexity 46 (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 · system-health-settings-page.SystemHealthSettingsPage (cyclomatic 45) · ×1
  • system-health-settings-page.SystemHealthSettingsPage (cyclomatic 45) apps/web/features/settings/center/system-health-settings-page.tsx:110 — system-health-settings-page.SystemHealthSettingsPage has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 11 of the 45 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 198, execute, a function literal at line 286, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ReaderPreferenceChangesKt.changedReaderControls (cyclomatic 44) · ×1
  • ReaderPreferenceChangesKt.changedReaderControls (cyclomatic 44) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderPreferenceChanges.kt:70 — ReaderPreferenceChangesKt.changedReaderControls has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · IosReaderComposition.bootstrap (cyclomatic 43) · ×1
  • IosReaderComposition.bootstrap (cyclomatic 43) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:177 — IosReaderComposition.bootstrap 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 · PdfReaderAdapter.execute (cyclomatic 43) · ×1
  • PdfReaderAdapter.execute (cyclomatic 43) apps/web/features/reader/v3/adapters/pdf-adapter.ts:367 — PdfReaderAdapter.execute 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 · email-settings-page.EmailSettingsPage (cyclomatic 43) · ×1
  • email-settings-page.EmailSettingsPage (cyclomatic 43) apps/web/features/settings/center/email-settings-page.tsx:64 — email-settings-page.EmailSettingsPage has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 14 of the 43 points are its own statements and the rest belongs to 8 function items inside it that branch (saveSmtp, a function literal at line 85, a function literal at line 106, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ProcessReadableResourceImportTask._process_prepared_resource (cyclomatic 42) · ×1
  • ProcessReadableResourceImportTask._process_prepared_resource (cyclomatic 42) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:360 — ProcessReadableResourceImportTask._process_prepared_resource has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · book_list.list_books (cyclomatic 42) · ×1
  • book_list.list_books (cyclomatic 42) apps/api-python/app/modules/library/infrastructure/book_list.py:411 — book_list.list_books has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReaderScreenKt.ReaderScreen (cyclomatic 42) · ×1
  • ReaderScreenKt.ReaderScreen (cyclomatic 42) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:201 — ReaderScreenKt.ReaderScreen has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ReaderScreenKt.ReaderOpenError (cyclomatic 45) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · RegistryResourceAdapterExecutor.parse_file (cyclomatic 41) · ×1
  • RegistryResourceAdapterExecutor.parse_file (cyclomatic 41) REDACTED:214 — RegistryResourceAdapterExecutor.parse_file 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 · AdministrativeSettingsUiKt.AdministrativeSettingsDestination (cyclomatic 41) · ×1
  • AdministrativeSettingsUiKt.AdministrativeSettingsDestination (cyclomatic 41) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:70 — AdministrativeSettingsUiKt.AdministrativeSettingsDestination has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · http_streaming._file_response (cyclomatic 39) · ×1
  • http_streaming._file_response (cyclomatic 39) apps/api-python/app/modules/media/infrastructure/http_streaming.py:725 — http_streaming._file_response has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · select.Select (cyclomatic 39) · ×1
  • select.Select (cyclomatic 39) apps/web/components/ui/select.tsx:86 — select.Select has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 10 of the 39 points are its own statements and the rest belongs to 10 function items inside it that branch (onKeyDown, a function literal at line 248, a function literal at line 143, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · combobox.Combobox (cyclomatic 39) · ×1
  • combobox.Combobox (cyclomatic 39) apps/web/components/ui/combobox.tsx:33 — combobox.Combobox has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 10 of the 39 points are its own statements and the rest belongs to 11 function items inside it that branch (onKeyDown, a function literal at line 199, a function literal at line 81, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · PdfReaderAdapter.renderPage (cyclomatic 39) · ×1
  • PdfReaderAdapter.renderPage (cyclomatic 39) apps/web/features/reader/v3/adapters/pdf-adapter.ts:692 — PdfReaderAdapter.renderPage has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · matching.match_metadata_candidates (cyclomatic 38) · ×1
  • matching.match_metadata_candidates (cyclomatic 38) apps/api-python/app/modules/metadata/infrastructure/matching.py:147 — matching.match_metadata_candidates has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · http.update_shelf (cyclomatic 38) · ×1
  • http.update_shelf (cyclomatic 38) apps/api-python/app/modules/shelf/presentation/http.py:727 — http.update_shelf 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 · dependency_preparation.verify_dependency_artifact (cyclomatic 38) · ×1
  • dependency_preparation.verify_dependency_artifact (cyclomatic 38) apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:110 — dependency_preparation.verify_dependency_artifact 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 · generate-reader-safety-policy.validate_fixture_manifest (cyclomatic 38) · ×1
  • generate-reader-safety-policy.validate_fixture_manifest (cyclomatic 38) packages/reader-contracts/generate-reader-safety-policy.py:568 — generate-reader-safety-policy.validate_fixture_manifest 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 · organize-page.OrganizePage (cyclomatic 37) · ×1
  • organize-page.OrganizePage (cyclomatic 37) apps/web/features/organize/organize-page.tsx:200 — organize-page.OrganizePage has cyclomatic complexity 37 (threshold 15). Of this number, 16 points are the body's own statements and 21 belong to 4 function items inside it that branch. 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 · ComicReaderAdapter.execute (cyclomatic 37) · ×1
  • ComicReaderAdapter.execute (cyclomatic 37) apps/web/features/reader/v3/adapters/comic-adapter.ts:317 — ComicReaderAdapter.execute 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 · http.create_kindle_send_task (cyclomatic 36) · ×1
  • http.create_kindle_send_task (cyclomatic 36) apps/api-python/app/modules/kindle/presentation/http.py:327 — http.create_kindle_send_task 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 · IosImageDirectoryBundle.init (cyclomatic 36) · ×1
  • IosImageDirectoryBundle.init (cyclomatic 36) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosImageDirectoryPublicationFactory.swift:19 — IosImageDirectoryBundle.init has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · book-content-browser.BookContentBrowser (cyclomatic 36) · ×1
  • book-content-browser.BookContentBrowser (cyclomatic 36) apps/web/features/books/ui/book-content-browser.tsx:75 — book-content-browser.BookContentBrowser has cyclomatic complexity 36 (threshold 15). Of this number, 26 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · prototype.app.addEventListener("click") (cyclomatic 36) · ×1
  • prototype.app.addEventListener("click") (cyclomatic 36) prototypes/feedback-web/prototype.js:335 — prototype.app.addEventListener("click") 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 · (anonymous) (cyclomatic 36) · ×1
  • (anonymous) (cyclomatic 36) prototypes/feedback-web/prototype.js:335 — (anonymous) 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 · ApplyRecognizedMetadata.execute (cyclomatic 35) · ×1
  • ApplyRecognizedMetadata.execute (cyclomatic 35) apps/api-python/app/modules/library/application/recognized_metadata.py:412 — ApplyRecognizedMetadata.execute has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · legacy_views._resource_view (cyclomatic 35) · ×1
  • legacy_views._resource_view (cyclomatic 35) apps/api-python/app/modules/library/infrastructure/legacy_views.py:177 — legacy_views._resource_view has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · generation.complete_missing_metadata (cyclomatic 35) · ×1
  • generation.complete_missing_metadata (cyclomatic 35) apps/api-python/app/modules/metadata/infrastructure/generation.py:29 — generation.complete_missing_metadata has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · context-action-menu.ContextActionMenu (cyclomatic 35) · ×1
  • context-action-menu.ContextActionMenu (cyclomatic 35) apps/web/components/ui/context-action-menu.tsx:24 — context-action-menu.ContextActionMenu has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 129, 65, 52, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · api.normalizeAudioBootstrap (cyclomatic 35) · ×1
  • api.normalizeAudioBootstrap (cyclomatic 35) apps/web/features/audio/api.ts:103 — api.normalizeAudioBootstrap has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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 · automation-settings-page.GrantsPanel (cyclomatic 35) · ×1
  • automation-settings-page.GrantsPanel (cyclomatic 35) apps/web/features/automation/ui/automation-settings-page.tsx:148 — automation-settings-page.GrantsPanel has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 161, a function literal at line 159, a function literal at line 174, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · file_writeback._publication (cyclomatic 34) · ×1
  • file_writeback._publication (cyclomatic 34) apps/api-python/app/modules/metadata/infrastructure/file_writeback.py:110 — file_writeback._publication has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · selective_opf.patch_opf_metadata (cyclomatic 34) · ×1
  • selective_opf.patch_opf_metadata (cyclomatic 34) apps/api-python/app/modules/metadata/infrastructure/selective_opf.py:88 — selective_opf.patch_opf_metadata has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · writeback_queue.prepare_targets_from_snapshot (cyclomatic 34) · ×1
  • writeback_queue.prepare_targets_from_snapshot (cyclomatic 34) apps/api-python/app/modules/metadata/infrastructure/writeback_queue.py:749 — writeback_queue.prepare_targets_from_snapshot has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BookManagementKt.ManagementAnchor (cyclomatic 34) · ×1
  • BookManagementKt.ManagementAnchor (cyclomatic 34) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/BookManagement.kt:150 — BookManagementKt.ManagementAnchor has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · account-panel.AccountPanel (cyclomatic 34) · ×1
  • account-panel.AccountPanel (cyclomatic 34) apps/web/features/settings/center/account-panel.tsx:32 — account-panel.AccountPanel has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to 7 function items inside it that branch (uploadAvatar, savePassword, saveName, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · strict-fb2-parser.parseStrictFb2.openElement (cyclomatic 34) · ×1
  • strict-fb2-parser.parseStrictFb2.openElement (cyclomatic 34) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:305 — strict-fb2-parser.parseStrictFb2.openElement has cyclomatic complexity 34 (threshold 15). Of this number, 29 points are the body's own statements and 5 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mobi-publication.openMobiPublication (cyclomatic 33) · ×1
  • mobi-publication.openMobiPublication (cyclomatic 33) apps/web/features/reader/v3/original-publication/mobi-publication.ts:93 — mobi-publication.openMobiPublication has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 12 function items inside it that branch (resolveAssetUrl, a function literal at line 185, a function literal at line 152, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · automation-settings-page.AutomationSettingsPage (cyclomatic 33) · ×1
  • automation-settings-page.AutomationSettingsPage (cyclomatic 33) apps/web/features/automation/ui/automation-settings-page.tsx:184 — automation-settings-page.AutomationSettingsPage has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 225, feedback, a function literal at line 232, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ProcessReadableResourceImportTask._refresh_single_file_metadata (cyclomatic 32) · ×1
  • ProcessReadableResourceImportTask._refresh_single_file_metadata (cyclomatic 32) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:593 — ProcessReadableResourceImportTask._refresh_single_file_metadata 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 · ExecuteFileMoveOperation.execute (cyclomatic 32) · ×1
  • ExecuteFileMoveOperation.execute (cyclomatic 32) apps/api-python/app/modules/library/application/execute_file_moves.py:86 — ExecuteFileMoveOperation.execute 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 · http.get_cover (cyclomatic 32) · ×1
  • http.get_cover (cyclomatic 32) apps/api-python/app/modules/media/presentation/http.py:273 — http.get_cover 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 · archive.extract_package (cyclomatic 32) · ×1
  • archive.extract_package (cyclomatic 32) apps/api-python/app/modules/updates/infrastructure/archive.py:137 — archive.extract_package 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 · ReaderScreenKt.ReaderContentsPanel (cyclomatic 32) · ×1
  • ReaderScreenKt.ReaderContentsPanel (cyclomatic 32) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:2116 — ReaderScreenKt.ReaderContentsPanel has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ReaderScreenKt.ReaderOpenError (cyclomatic 45) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · smart-filter-builder.SmartFilterBuilder (cyclomatic 32) · ×1
  • smart-filter-builder.SmartFilterBuilder (cyclomatic 32) apps/web/features/library/smart-filter-builder.tsx:80 — smart-filter-builder.SmartFilterBuilder has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 7 function items inside it that branch (valueEditor, changeOperator, changeField, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · CentralDirectoryReader.read (cyclomatic 31) · ×1
  • CentralDirectoryReader.read (cyclomatic 31) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:424 — CentralDirectoryReader.read 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 · comic_archives.inspect_comic_archive (cyclomatic 30) · ×1
  • comic_archives.inspect_comic_archive (cyclomatic 30) REDACTED:498 — comic_archives.inspect_comic_archive has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · http._organize_job_view (cyclomatic 30) · ×1
  • http._organize_job_view (cyclomatic 30) apps/api-python/app/modules/organize/presentation/http.py:130 — http._organize_job_view has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · epub_adapter._index_epub (cyclomatic 30) · ×1
  • epub_adapter._index_epub (cyclomatic 30) REDACTED:417 — epub_adapter._index_epub 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 · verify-reader-safety-conformance.load_suite_and_expected (cyclomatic 30) · ×1
  • verify-reader-safety-conformance.load_suite_and_expected (cyclomatic 30) packages/reader-contracts/verify-reader-safety-conformance.py:222 — verify-reader-safety-conformance.load_suite_and_expected 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 · DownloadManagementPolicy.project (cyclomatic 30) · ×1
  • DownloadManagementPolicy.project (cyclomatic 30) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/domain/DownloadManagement.kt:48 — DownloadManagementPolicy.project has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · IosEpubArchiveSafetyPreflight.verifyMetadata (cyclomatic 30) · ×1
  • IosEpubArchiveSafetyPreflight.verifyMetadata (cyclomatic 30) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:91 — IosEpubArchiveSafetyPreflight.verifyMetadata 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 · reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile (cyclomatic 30) · ×1
  • reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile (cyclomatic 30) apps/web/features/reader/v3/security/reader-safety-policy.ts:699 — reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile has cyclomatic complexity 30 (threshold 15). Of this number, 15 points are the body's own statements and 15 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · reader-shell.ResourceNavigationPanel (cyclomatic 30) · ×1
  • reader-shell.ResourceNavigationPanel (cyclomatic 30) apps/web/features/reader/reader-shell.tsx:1383 — reader-shell.ResourceNavigationPanel has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1436, 1413, 1396). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · classification-management-panel.ClassificationManagementPanel (cyclomatic 30) · ×1
  • classification-management-panel.ClassificationManagementPanel (cyclomatic 30) apps/web/features/organize/classification-management-panel.tsx:24 — classification-management-panel.ClassificationManagementPanel has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 11 of the 30 points are its own statements and the rest belongs to 10 function items inside it that branch (rename, merge, removeCategory, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AutomationUploads.complete (cyclomatic 29) · ×1
  • AutomationUploads.complete (cyclomatic 29) apps/api-python/app/modules/automation/application/uploads.py:329 — AutomationUploads.complete 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 · ScanLibrarySourceTree._execute_scopes (cyclomatic 29) · ×1
  • ScanLibrarySourceTree._execute_scopes (cyclomatic 29) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:336 — ScanLibrarySourceTree._execute_scopes 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 · reflowable_metadata._inspect_mobi_family (cyclomatic 29) · ×1
  • reflowable_metadata._inspect_mobi_family (cyclomatic 29) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:191 — reflowable_metadata._inspect_mobi_family has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkDetailScreenKt.WorkDetailActionRow (cyclomatic 29) · ×1
  • WorkDetailScreenKt.WorkDetailActionRow (cyclomatic 29) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:715 — WorkDetailScreenKt.WorkDetailActionRow has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · use-update-operations.useUpdateOperations (cyclomatic 29) · ×1
  • use-update-operations.useUpdateOperations (cyclomatic 29) apps/web/features/updates/application/use-update-operations.ts:9 — use-update-operations.useUpdateOperations has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 38, 33, 24, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · recognition-settings-panel.RecognitionSettingsPanel (cyclomatic 29) · ×1
  • recognition-settings-panel.RecognitionSettingsPanel (cyclomatic 29) apps/web/features/organize/recognition-settings-panel.tsx:75 — recognition-settings-panel.RecognitionSettingsPanel has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 86, save, a function literal at line 145, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · 0037_single_import_execution.upgrade (cyclomatic 28) · ×1
  • 0037_single_import_execution.upgrade (cyclomatic 28) apps/api-python/app/db/alembic/versions/0037_single_import_execution.py:51 — 0037_single_import_execution.upgrade 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 · inspection.inspect_backup (cyclomatic 28) · ×1
  • inspection.inspect_backup (cyclomatic 28) apps/api-python/app/modules/backup/infrastructure/inspection.py:36 — inspection.inspect_backup 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 · audio_metadata._read_with_ffprobe (cyclomatic 28) · ×1
  • audio_metadata._read_with_ffprobe (cyclomatic 28) apps/api-python/app/services/audio_metadata.py:249 — audio_metadata._read_with_ffprobe 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 · records.installed_records (cyclomatic 28) · ×1
  • records.installed_records (cyclomatic 28) apps/api-python/shuku_dependencies/records.py:18 — records.installed_records 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 · LoginScreenKt.LoginScreen (cyclomatic 28) · ×1
  • LoginScreenKt.LoginScreen (cyclomatic 28) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/auth/LoginScreen.kt:74 — LoginScreenKt.LoginScreen 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 · WorkDetailScreenKt.WorkDetailScreen (cyclomatic 28) · ×1
  • WorkDetailScreenKt.WorkDetailScreen (cyclomatic 28) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:206 — WorkDetailScreenKt.WorkDetailScreen 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 · ReaderPreferenceSheet.settingRow (cyclomatic 28) · ×1
  • ReaderPreferenceSheet.settingRow (cyclomatic 28) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlSheets.swift:244 — ReaderPreferenceSheet.settingRow 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 · kindle-send-modal.KindleSendModal (cyclomatic 28) · ×1
  • kindle-send-modal.KindleSendModal (cyclomatic 28) apps/web/features/books/kindle-send-modal.tsx:24 — kindle-send-modal.KindleSendModal has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 6 function items inside it that branch (enqueue, a function literal at line 47, a function literal at line 110, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · kindle-send-queue-page.KindleSendQueuePage (cyclomatic 28) · ×1
  • kindle-send-queue-page.KindleSendQueuePage (cyclomatic 28) apps/web/features/kindle/kindle-send-queue-page.tsx:90 — kindle-send-queue-page.KindleSendQueuePage has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 5 of the 28 points are its own statements and the rest belongs to 4 function items inside it that branch (mutate, a function literal at line 179, a function literal at line 100, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · OsSourceTreeFilesystem.probe_directory (cyclomatic 27) · ×1
  • OsSourceTreeFilesystem.probe_directory (cyclomatic 27) apps/api-python/app/modules/imports/infrastructure/readable_resource/filesystem.py:131 — OsSourceTreeFilesystem.probe_directory has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqlAlchemyBulkBookOperations.update_metadata (cyclomatic 27) · ×1
  • SqlAlchemyBulkBookOperations.update_metadata (cyclomatic 27) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:341 — SqlAlchemyBulkBookOperations.update_metadata has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SqlAlchemyBookResourceRepository.save_directory_assets (cyclomatic 27) · ×1
  • SqlAlchemyBookResourceRepository.save_directory_assets (cyclomatic 27) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1400 — SqlAlchemyBookResourceRepository.save_directory_assets has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opf.parse_opf_metadata (cyclomatic 27) · ×1
  • opf.parse_opf_metadata (cyclomatic 27) REDACTED:150 — opf.parse_opf_metadata has cyclomatic complexity 27 (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 · ReaderScreenKt.ReaderBottomConsole (cyclomatic 27) · ×1
  • ReaderScreenKt.ReaderBottomConsole (cyclomatic 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:734 — ReaderScreenKt.ReaderBottomConsole has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: ReaderScreenKt.ReaderOpenError (cyclomatic 45) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ShelfCatalogScreenKt.ShelfCatalogScreen (cyclomatic 27) · ×1
  • ShelfCatalogScreenKt.ShelfCatalogScreen (cyclomatic 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shelves/ui/ShelfCatalogScreen.kt:81 — ShelfCatalogScreenKt.ShelfCatalogScreen has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ManagedDownloadStore.verifiedPageSetBytes (cyclomatic 27) · ×1
  • ManagedDownloadStore.verifiedPageSetBytes (cyclomatic 27) apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:212 — ManagedDownloadStore.verifiedPageSetBytes has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · session.readerSessionReducer (cyclomatic 27) · ×1
  • session.readerSessionReducer (cyclomatic 27) packages/reader-core/src/session.ts:96 — session.readerSessionReducer has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · http.update_download_task (cyclomatic 26) · ×1
  • http.update_download_task (cyclomatic 26) apps/api-python/app/modules/download/presentation/http.py:271 — http.update_download_task has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReadableResourceWorkerProcessor._execute_book (cyclomatic 26) · ×1
  • ReadableResourceWorkerProcessor._execute_book (cyclomatic 26) apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py:246 — ReadableResourceWorkerProcessor._execute_book has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · move_companions.move_companion_paths (cyclomatic 26) · ×1
  • move_companions.move_companion_paths (cyclomatic 26) apps/api-python/app/modules/library/infrastructure/move_companions.py:26 — move_companions.move_companion_paths has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StandardMetadataPublication.prepare (cyclomatic 26) · ×1
  • StandardMetadataPublication.prepare (cyclomatic 26) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:204 — StandardMetadataPublication.prepare has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · organize_service.bangumi_candidates (cyclomatic 26) · ×1
  • organize_service.bangumi_candidates (cyclomatic 26) REDACTED:828 — organize_service.bangumi_candidates has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · packages.node_packages (cyclomatic 26) · ×1
  • packages.node_packages (cyclomatic 26) apps/api-python/shuku_dependencies/packages.py:135 — packages.node_packages has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DownloadCenterStore.removeManagementDownload (cyclomatic 26) · ×1
  • DownloadCenterStore.removeManagementDownload (cyclomatic 26) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:481 — DownloadCenterStore.removeManagementDownload has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · book-action-controller.BookActionController · ×1
  • book-action-controller.BookActionController::invoke (cyclomatic 26) apps/web/features/books/ui/book-action-controller.tsx:109 — book-action-controller.BookActionController::invoke has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · automation-settings-page.ConfigurationPanel (cyclomatic 26) · ×1
  • automation-settings-page.ConfigurationPanel (cyclomatic 26) apps/web/features/automation/ui/automation-settings-page.tsx:87 — automation-settings-page.ConfigurationPanel has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (copy, download, a function literal at line 137, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · UpdateUser.execute (cyclomatic 25) · ×1
  • UpdateUser.execute (cyclomatic 25) apps/api-python/app/modules/auth/application/user_management.py:236 — UpdateUser.execute 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 · ProcessBookResources.execute (cyclomatic 25) · ×1
  • ProcessBookResources.execute (cyclomatic 25) apps/api-python/app/modules/imports/application/readable_resource/process_book_resources.py:133 — ProcessBookResources.execute 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 · SqlAlchemyBulkBookOperations.prepare_covers (cyclomatic 25) · ×1
  • SqlAlchemyBulkBookOperations.prepare_covers (cyclomatic 25) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:881 — SqlAlchemyBulkBookOperations.prepare_covers 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 · selective_comicinfo.patch_comicinfo (cyclomatic 25) · ×1
  • selective_comicinfo.patch_comicinfo (cyclomatic 25) apps/api-python/app/modules/metadata/infrastructure/selective_comicinfo.py:26 — selective_comicinfo.patch_comicinfo 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 · organize_service.run_douban_crawler_provider (cyclomatic 25) · ×1
  • organize_service.run_douban_crawler_provider (cyclomatic 25) REDACTED:680 — organize_service.run_douban_crawler_provider 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 · AdministrativePeopleAndQueueScreensKt.UserEditScreen (cyclomatic 25) · ×1
  • AdministrativePeopleAndQueueScreensKt.UserEditScreen (cyclomatic 25) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:234 — AdministrativePeopleAndQueueScreensKt.UserEditScreen 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 · WorkDetailScreenKt.WorkDetailBody (cyclomatic 25) · ×1
  • WorkDetailScreenKt.WorkDetailBody (cyclomatic 25) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:520 — WorkDetailScreenKt.WorkDetailBody 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 · organize-job-detail-page.OrganizeJobDetailPage (cyclomatic 25) · ×1
  • organize-job-detail-page.OrganizeJobDetailPage (cyclomatic 25) apps/web/features/organize/organize-job-detail-page.tsx:46 — organize-job-detail-page.OrganizeJobDetailPage has cyclomatic complexity 25 (threshold 15). Of this number, 17 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReadiumWebReaderAdapter.execute (cyclomatic 25) · ×1
  • ReadiumWebReaderAdapter.execute (cyclomatic 25) apps/web/features/reader/v3/adapters/readium-adapter.ts:549 — ReadiumWebReaderAdapter.execute 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 · library_paths.library_directory_tree_node (cyclomatic 24) · ×1
  • library_paths.library_directory_tree_node (cyclomatic 24) apps/api-python/app/modules/imports/application/library_paths.py:45 — library_paths.library_directory_tree_node 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 · SqlAlchemySourceNodeRepository.reconcile_batch (cyclomatic 24) · ×1
  • SqlAlchemySourceNodeRepository.reconcile_batch (cyclomatic 24) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:269 — SqlAlchemySourceNodeRepository.reconcile_batch 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 · AnchoredStandardMetadataReader._read_one (cyclomatic 24) · ×1
  • AnchoredStandardMetadataReader._read_one (cyclomatic 24) apps/api-python/app/modules/metadata/infrastructure/standard_files.py:187 — AnchoredStandardMetadataReader._read_one 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 · AndroidEpubArchiveSafetyPreflight.verifyMetadata (cyclomatic 24) · ×1
  • AndroidEpubArchiveSafetyPreflight.verifyMetadata (cyclomatic 24) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidEpubArchiveSafetyPreflight.kt:72 — AndroidEpubArchiveSafetyPreflight.verifyMetadata 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 · metadata-lookup-modal.MetadataLookupModal (cyclomatic 24) · ×1
  • metadata-lookup-modal.MetadataLookupModal (cyclomatic 24) apps/web/features/books/metadata-lookup-modal.tsx:92 — metadata-lookup-modal.MetadataLookupModal 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. This shape REPEATS in the file: one other method here (metadata-lookup-modal.MetadataLookupModal::applySelected) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · RegistryResourceAdapterExecutor._epub_navigation (cyclomatic 23) · ×1
  • RegistryResourceAdapterExecutor._epub_navigation (cyclomatic 23) REDACTED:483 — RegistryResourceAdapterExecutor._epub_navigation 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 · reflowable_metadata._inspect_fb2 (cyclomatic 23) · ×1
  • reflowable_metadata._inspect_fb2 (cyclomatic 23) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:97 — reflowable_metadata._inspect_fb2 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 · writes.import_book_files (cyclomatic 23) · ×1
  • writes.import_book_files (cyclomatic 23) apps/api-python/app/modules/imports/presentation/writes.py:114 — writes.import_book_files 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 · filter_query._condition (cyclomatic 23) · ×1
  • filter_query._condition (cyclomatic 23) apps/api-python/app/modules/library/infrastructure/filter_query.py:262 — filter_query._condition 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 · resource_reader._derive_display_percent (cyclomatic 23) · ×1
  • resource_reader._derive_display_percent (cyclomatic 23) apps/api-python/app/modules/reader/application/resource_reader.py:465 — resource_reader._derive_display_percent 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 · kindle_queue._send_task (cyclomatic 23) · ×1
  • kindle_queue._send_task (cyclomatic 23) apps/api-python/app/services/kindle_queue.py:181 — kindle_queue._send_task 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 · WorkDetailViewModel.loadMultiDownloadFolder (cyclomatic 23) · ×1
  • WorkDetailViewModel.loadMultiDownloadFolder (cyclomatic 23) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:682 — WorkDetailViewModel.loadMultiDownloadFolder 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 · ManagementTagEditorKt.ManagementTagEditor (cyclomatic 23) · ×1
  • ManagementTagEditorKt.ManagementTagEditor (cyclomatic 23) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/ManagementTagEditor.kt:56 — ManagementTagEditorKt.ManagementTagEditor 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 · use-reader-session.useReaderSession (cyclomatic 23) · ×1
  • use-reader-session.useReaderSession (cyclomatic 23) apps/web/features/reader/v3/use-reader-session.ts:150 — use-reader-session.useReaderSession has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 226, 286, 283, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · book-card.BookCard (cyclomatic 23) · ×1
  • book-card.BookCard (cyclomatic 23) apps/web/components/book/book-card.tsx:18 — book-card.BookCard has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · strict-fb2-parser.namespacesForElement (cyclomatic 23) · ×1
  • strict-fb2-parser.namespacesForElement (cyclomatic 23) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:180 — strict-fb2-parser.namespacesForElement 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 · strict-fb2-parser.parseStrictFb2 (cyclomatic 23) · ×1
  • strict-fb2-parser.parseStrictFb2 (cyclomatic 23) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:248 — strict-fb2-parser.parseStrictFb2 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 · text-publication.worker.materializeFb2Chapter (cyclomatic 23) · ×1
  • text-publication.worker.materializeFb2Chapter (cyclomatic 23) apps/web/features/reader/v3/original-publication/text-publication.worker.ts:108 — text-publication.worker.materializeFb2Chapter 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 · generate-reader-api.typeExpression (cyclomatic 23) · ×1
  • generate-reader-api.typeExpression (cyclomatic 23) apps/web/scripts/generate-reader-api.mjs:48 — generate-reader-api.typeExpression has cyclomatic complexity 23 (threshold 15). Of this number, 22 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 · AutomationWrites.book_tags (cyclomatic 22) · ×1
  • AutomationWrites.book_tags (cyclomatic 22) apps/api-python/app/modules/automation/application/writes.py:337 — AutomationWrites.book_tags 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 · http_streaming._send_zip_entry (cyclomatic 22) · ×1
  • http_streaming._send_zip_entry (cyclomatic 22) apps/api-python/app/modules/media/infrastructure/http_streaming.py:975 — http_streaming._send_zip_entry 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 · audio_writeback.write_audio_metadata (cyclomatic 22) · ×1
  • audio_writeback.write_audio_metadata (cyclomatic 22) apps/api-python/app/modules/metadata/infrastructure/audio_writeback.py:90 — audio_writeback.write_audio_metadata 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 · ReadiumComicSession.prepare (cyclomatic 22) · ×1
  • ReadiumComicSession.prepare (cyclomatic 22) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:160 — ReadiumComicSession.prepare 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 · ApiClient.execute (cyclomatic 22) · ×1
  • ApiClient.execute (cyclomatic 22) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:162 — ApiClient.execute 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 · ManagedDownloadRecord.verifiedSharedArtifact (cyclomatic 22) · ×1
  • ManagedDownloadRecord.verifiedSharedArtifact (cyclomatic 22) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadModels.swift:94 — ManagedDownloadRecord.verifiedSharedArtifact has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · IosPdfiumNavigatorViewController.startRender (cyclomatic 22) · ×1
  • IosPdfiumNavigatorViewController.startRender (cyclomatic 22) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumNavigator.swift:149 — IosPdfiumNavigatorViewController.startRender 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 · reader-safety-policy.findDoctype (cyclomatic 22) · ×1
  • reader-safety-policy.findDoctype (cyclomatic 22) apps/web/features/reader/v3/security/reader-safety-policy.ts:96 — reader-safety-policy.findDoctype 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 · ComicSpreadTrackDriver.renderSlot (cyclomatic 22) · ×1
  • ComicSpreadTrackDriver.renderSlot (cyclomatic 22) apps/web/features/reader/v3/adapters/comic-track.ts:312 — ComicSpreadTrackDriver.renderSlot has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opds-settings-page.OpdsSettingsPage (cyclomatic 22) · ×1
  • opds-settings-page.OpdsSettingsPage (cyclomatic 22) apps/web/features/settings/center/opds-settings-page.tsx:12 — opds-settings-page.OpdsSettingsPage has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (toggleEnabled, savePublicBaseUrl, a function literal at line 28, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AutomationUploads.begin_upload (cyclomatic 21) · ×1
  • AutomationUploads.begin_upload (cyclomatic 21) apps/api-python/app/modules/automation/application/uploads.py:182 — AutomationUploads.begin_upload has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · application.prepare_preview (cyclomatic 21) · ×1
  • application.prepare_preview (cyclomatic 21) apps/api-python/app/modules/feedback/application.py:45 — application.prepare_preview 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 · BookWork.__post_init__ (cyclomatic 21) · ×1
  • BookWork.__post_init__ (cyclomatic 21) apps/api-python/app/modules/imports/application/readable_resource/book_work.py:25 — BookWork.__post_init__ has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ScanLibrarySourceTree._process_regular_file (cyclomatic 21) · ×1
  • ScanLibrarySourceTree._process_regular_file (cyclomatic 21) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1206 — ScanLibrarySourceTree._process_regular_file 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 · http.update_library (cyclomatic 21) · ×1
  • http.update_library (cyclomatic 21) apps/api-python/app/modules/imports/presentation/http.py:367 — http.update_library has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · filter_ast.parse_filter_expression (cyclomatic 21) · ×1
  • filter_ast.parse_filter_expression (cyclomatic 21) apps/api-python/app/modules/library/application/filter_ast.py:100 — filter_ast.parse_filter_expression 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 · ApplyMetadataPatches.execute (cyclomatic 21) · ×1
  • ApplyMetadataPatches.execute (cyclomatic 21) apps/api-python/app/modules/library/application/metadata_patches.py:100 — ApplyMetadataPatches.execute 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 · UpdateSourceNodePresentation.execute (cyclomatic 21) · ×1
  • UpdateSourceNodePresentation.execute (cyclomatic 21) apps/api-python/app/modules/library/application/source_node_commands.py:158 — UpdateSourceNodePresentation.execute has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SqlAlchemyMetadataPatches.snapshot (cyclomatic 21) · ×1
  • SqlAlchemyMetadataPatches.snapshot (cyclomatic 21) apps/api-python/app/modules/library/infrastructure/metadata_patches.py:121 — SqlAlchemyMetadataPatches.snapshot 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 · SqlAlchemyMetadataPatches.apply (cyclomatic 21) · ×1
  • SqlAlchemyMetadataPatches.apply (cyclomatic 21) apps/api-python/app/modules/library/infrastructure/metadata_patches.py:290 — SqlAlchemyMetadataPatches.apply 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 · SqlAlchemySourceNodeMetadata.update_metadata (cyclomatic 21) · ×1
  • SqlAlchemySourceNodeMetadata.update_metadata (cyclomatic 21) apps/api-python/app/modules/library/infrastructure/source_node_commands.py:49 — SqlAlchemySourceNodeMetadata.update_metadata 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 · library_filters.normalize_filter_rules (cyclomatic 21) · ×1
  • library_filters.normalize_filter_rules (cyclomatic 21) apps/api-python/app/services/library_filters.py:52 — library_filters.normalize_filter_rules 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 · ErmaoLibraryRootKt.ErmaoLibraryRoot (cyclomatic 21) · ×1
  • ErmaoLibraryRootKt.ErmaoLibraryRoot (cyclomatic 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/bootstrap/ErmaoLibraryRoot.kt:32 — ErmaoLibraryRootKt.ErmaoLibraryRoot has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReadiumPreferencesMapper.toReadium (cyclomatic 21) · ×1
  • ReadiumPreferencesMapper.toReadium (cyclomatic 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPreferencesMapper.kt:28 — ReadiumPreferencesMapper.toReadium has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReaderActivity.dispatchKeyEvent (cyclomatic 21) · ×1
  • ReaderActivity.dispatchKeyEvent (cyclomatic 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:303 — ReaderActivity.dispatchKeyEvent has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · XmlControlPreprocessor.expandInternalEntity (cyclomatic 21) · ×1
  • XmlControlPreprocessor.expandInternalEntity (cyclomatic 21) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:752 — XmlControlPreprocessor.expandInternalEntity 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 · BookManagementSession.select (cyclomatic 21) · ×1
  • BookManagementSession.select (cyclomatic 21) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/application/BookManagementSession.kt:175 — BookManagementSession.select has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · reader-safety-policy.parseEntityDefinitions (cyclomatic 21) · ×1
  • reader-safety-policy.parseEntityDefinitions (cyclomatic 21) apps/web/features/reader/v3/security/reader-safety-policy.ts:174 — reader-safety-policy.parseEntityDefinitions 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 · upload-book-dialog.UploadBookDialog (cyclomatic 21) · ×1
  • upload-book-dialog.UploadBookDialog (cyclomatic 21) apps/web/features/library/upload-book-dialog.tsx:26 — upload-book-dialog.UploadBookDialog has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 5 function items inside it that branch (saveFiles, a function literal at line 37, a function literal at line 35, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · client.mapBookView (cyclomatic 21) · ×1
  • client.mapBookView (cyclomatic 21) apps/web/features/books/api/client.ts:158 — client.mapBookView has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · client.searchSourceNodeMetadata (cyclomatic 21) · ×1
  • client.searchSourceNodeMetadata (cyclomatic 21) apps/web/features/books/api/client.ts:364 — client.searchSourceNodeMetadata has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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 · book-metadata-editor.BookMetadataEditor (cyclomatic 21) · ×1
  • book-metadata-editor.BookMetadataEditor (cyclomatic 21) apps/web/features/books/ui/book-metadata-editor.tsx:43 — book-metadata-editor.BookMetadataEditor has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 5 function items inside it that branch (save, a function literal at line 117, a function literal at line 149, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · IndexedDbPublicationStorage.read (cyclomatic 21) · ×1
  • IndexedDbPublicationStorage.read (cyclomatic 21) apps/web/features/reader/v3/original-publication/indexeddb-publication-storage.ts:168 — IndexedDbPublicationStorage.read has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 169). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · settings-secondary-nav.SettingsSecondaryNav (cyclomatic 21) · ×1
  • settings-secondary-nav.SettingsSecondaryNav (cyclomatic 21) apps/web/features/settings/center/settings-secondary-nav.tsx:65 — settings-secondary-nav.SettingsSecondaryNav has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function items inside it that branch (a function literal at line 101, beginNavigation, a function literal at line 83, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · dashboard-page.DashboardPage (cyclomatic 21) · ×1
  • dashboard-page.DashboardPage (cyclomatic 21) apps/web/features/dashboard/dashboard-page.tsx:40 — dashboard-page.DashboardPage has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 58, 131, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · automation-settings-page.GrantForm (cyclomatic 21) · ×1
  • automation-settings-page.GrantForm (cyclomatic 21) apps/web/features/automation/ui/automation-settings-page.tsx:52 — automation-settings-page.GrantForm has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 4 function items inside it that branch. 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 · server-exceptions.writeServerLog (cyclomatic 21) · ×1
  • server-exceptions.writeServerLog (cyclomatic 21) apps/web/lib/server-exceptions.ts:15 — server-exceptions.writeServerLog has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · 0031_book_import_task_backfill.backfill_book_tasks (cyclomatic 20) · ×1
  • 0031_book_import_task_backfill.backfill_book_tasks (cyclomatic 20) apps/api-python/app/db/alembic/versions/0031_book_import_task_backfill.py:168 — 0031_book_import_task_backfill.backfill_book_tasks 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 · FileDeletions.execute (cyclomatic 20) · ×1
  • FileDeletions.execute (cyclomatic 20) apps/api-python/app/modules/library/application/file_deletions.py:146 — FileDeletions.execute 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 · SqlAlchemyBookResourceRepository.apply_local_metadata (cyclomatic 20) · ×1
  • SqlAlchemyBookResourceRepository.apply_local_metadata (cyclomatic 20) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1016 — SqlAlchemyBookResourceRepository.apply_local_metadata 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 · audio_structure.mp3_structure (cyclomatic 20) · ×1
  • audio_structure.mp3_structure (cyclomatic 20) apps/api-python/app/modules/metadata/infrastructure/audio_structure.py:48 — audio_structure.mp3_structure 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 · ResourceLocatorIndex.validate (cyclomatic 20) · ×1
  • ResourceLocatorIndex.validate (cyclomatic 20) apps/api-python/app/modules/reader/infrastructure/resource_locator_index.py:28 — ResourceLocatorIndex.validate 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 · health_runs._run_health_checks (cyclomatic 20) · ×1
  • health_runs._run_health_checks (cyclomatic 20) apps/api-python/app/modules/system/infrastructure/health_runs.py:731 — health_runs._run_health_checks 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 · verify-reader-safety-conformance.validate_report (cyclomatic 20) · ×1
  • verify-reader-safety-conformance.validate_report (cyclomatic 20) packages/reader-contracts/verify-reader-safety-conformance.py:400 — verify-reader-safety-conformance.validate_report 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 · AdministrativeSettingsViewModel.execute (cyclomatic 20) · ×1
  • AdministrativeSettingsViewModel.execute (cyclomatic 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsViewModel.kt:102 — AdministrativeSettingsViewModel.execute has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AdministrativeSettingsViewModelKt.supports (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AndroidAudioPlaybackRuntime.launchRemote (cyclomatic 20) · ×1
  • AndroidAudioPlaybackRuntime.launchRemote (cyclomatic 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:323 — AndroidAudioPlaybackRuntime.launchRemote has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · DownloadResourceRowKt.DownloadResourceRow (cyclomatic 20) · ×1
  • DownloadResourceRowKt.DownloadResourceRow (cyclomatic 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/DownloadResourceRow.kt:49 — DownloadResourceRowKt.DownloadResourceRow 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 · FacetViewModel.load (cyclomatic 20) · ×1
  • FacetViewModel.load (cyclomatic 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:124 — FacetViewModel.load 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 · ReadiumEpubSession.openLocalPublication (cyclomatic 20) · ×1
  • ReadiumEpubSession.openLocalPublication (cyclomatic 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:211 — ReadiumEpubSession.openLocalPublication has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ApiClient.loadAuthenticatedAsset (cyclomatic 20) · ×1
  • ApiClient.loadAuthenticatedAsset (cyclomatic 20) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:301 — ApiClient.loadAuthenticatedAsset 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 · ApiClient.loadAuthenticatedBinary (cyclomatic 20) · ×1
  • ApiClient.loadAuthenticatedBinary (cyclomatic 20) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:495 — ApiClient.loadAuthenticatedBinary has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · DownloadResourceRuntime.ensure (cyclomatic 20) · ×1
  • DownloadResourceRuntime.ensure (cyclomatic 20) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/application/DownloadResourceRuntime.kt:124 — DownloadResourceRuntime.ensure 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 · IosReaderBootstrapHost.beginDownload (cyclomatic 20) · ×1
  • IosReaderBootstrapHost.beginDownload (cyclomatic 20) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:766 — IosReaderBootstrapHost.beginDownload 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 · IosReaderBootstrapView.body (cyclomatic 20) · ×1
  • IosReaderBootstrapView.body (cyclomatic 20) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:908 — IosReaderBootstrapView.body 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 · MultiDownloadSheet.perform (cyclomatic 20) · ×1
  • MultiDownloadSheet.perform (cyclomatic 20) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:821 — MultiDownloadSheet.perform 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 · provider.translateDomNode (cyclomatic 20) · ×1
  • provider.translateDomNode (cyclomatic 20) apps/web/i18n/provider.tsx:70 — provider.translateDomNode 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 · PagedTrackController.pointerUp (cyclomatic 20) · ×1
  • PagedTrackController.pointerUp (cyclomatic 20) apps/web/features/reader/v3/paged-track/paged-track-controller.ts:198 — PagedTrackController.pointerUp has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · bounded-response.readBoundedResponse (cyclomatic 20) · ×1
  • bounded-response.readBoundedResponse (cyclomatic 20) apps/web/shared/api/bounded-response.ts:9 — bounded-response.readBoundedResponse 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 · strict-fb2-parser.parseStrictFb2.closeElement (cyclomatic 20) · ×1
  • strict-fb2-parser.parseStrictFb2.closeElement (cyclomatic 20) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:399 — strict-fb2-parser.parseStrictFb2.closeElement 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 · exception_diagnostics._exception_facts (cyclomatic 19) · ×1
  • exception_diagnostics._exception_facts (cyclomatic 19) apps/api-python/app/core/exception_diagnostics.py:218 — exception_diagnostics._exception_facts 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 · exception_diagnostics.format_exception_diagnostics (cyclomatic 19) · ×1
  • exception_diagnostics.format_exception_diagnostics (cyclomatic 19) apps/api-python/app/core/exception_diagnostics.py:343 — exception_diagnostics.format_exception_diagnostics 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 · persistence._converted_column_value (cyclomatic 19) · ×1
  • persistence._converted_column_value (cyclomatic 19) apps/api-python/app/modules/backup/infrastructure/persistence.py:203 — persistence._converted_column_value 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 · identity_policy.parse_bracketed_series_identity (cyclomatic 19) · ×1
  • identity_policy.parse_bracketed_series_identity (cyclomatic 19) apps/api-python/app/modules/imports/application/identity_policy.py:191 — identity_policy.parse_bracketed_series_identity 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 · ReadableResourceWorkerProcessor._finish (cyclomatic 19) · ×1
  • ReadableResourceWorkerProcessor._finish (cyclomatic 19) apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py:152 — ReadableResourceWorkerProcessor._finish 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 · PrepareFileMovePlan.execute (cyclomatic 19) · ×1
  • PrepareFileMovePlan.execute (cyclomatic 19) apps/api-python/app/modules/library/application/file_move_plans.py:114 — PrepareFileMovePlan.execute 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 · metadata_patch.validate_value (cyclomatic 19) · ×1
  • metadata_patch.validate_value (cyclomatic 19) apps/api-python/app/modules/library/domain/metadata_patch.py:68 — metadata_patch.validate_value 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 · books._book_record (cyclomatic 19) · ×1
  • books._book_record (cyclomatic 19) apps/api-python/app/modules/library/infrastructure/books.py:230 — books._book_record 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 · SqlAlchemyBulkBookOperations.apply_find_replace (cyclomatic 19) · ×1
  • SqlAlchemyBulkBookOperations.apply_find_replace (cyclomatic 19) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:572 — SqlAlchemyBulkBookOperations.apply_find_replace 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 · commands.prepare_organize_policy_update (cyclomatic 19) · ×1
  • commands.prepare_organize_policy_update (cyclomatic 19) apps/api-python/app/modules/organize/application/commands.py:49 — commands.prepare_organize_policy_update 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 · smart_rules.normalize_smart_shelf_rules (cyclomatic 19) · ×1
  • smart_rules.normalize_smart_shelf_rules (cyclomatic 19) apps/api-python/app/modules/shelf/application/smart_rules.py:7 — smart_rules.normalize_smart_shelf_rules 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 · http.create_shelf (cyclomatic 19) · ×1
  • http.create_shelf (cyclomatic 19) apps/api-python/app/modules/shelf/presentation/http.py:609 — http.create_shelf 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 · AdministrativeSettingsUiKt.failureText (cyclomatic 19) · ×1
  • AdministrativeSettingsUiKt.failureText (cyclomatic 19) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:329 — AdministrativeSettingsUiKt.failureText has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AdministrativeSettingsUiKt.administrativeSuccessText (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AndroidAudioPlaybackRuntime.publishFromController (cyclomatic 19) · ×1
  • AndroidAudioPlaybackRuntime.publishFromController (cyclomatic 19) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:1115 — AndroidAudioPlaybackRuntime.publishFromController 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 · ApiClient.loadAuthenticatedJson (cyclomatic 19) · ×1
  • ApiClient.loadAuthenticatedJson (cyclomatic 19) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:405 — ApiClient.loadAuthenticatedJson 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 · recognized-metadata.currentMetadataValue (cyclomatic 19) · ×1
  • recognized-metadata.currentMetadataValue (cyclomatic 19) apps/web/features/books/model/recognized-metadata.ts:73 — recognized-metadata.currentMetadataValue 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 · source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog · ×1
  • source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog::apply (cyclomatic 19) apps/web/features/books/ui/source-node-metadata-dialogs.tsx:152 — source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog::apply 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 · login-page.LoginPage (cyclomatic 19) · ×1
  • login-page.LoginPage (cyclomatic 19) apps/web/features/settings/login-page.tsx:34 — login-page.LoginPage has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (submit, a function literal at line 51, a function literal at line 60). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · reader-shell.ReaderPreferencesPanel · ×1
  • reader-shell.ReaderPreferencesPanel::control (cyclomatic 19) apps/web/features/reader/reader-shell.tsx:1500 — reader-shell.ReaderPreferencesPanel::control 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 · import-preferences-panel.ImportPreferencesPanel (cyclomatic 19) · ×1
  • import-preferences-panel.ImportPreferencesPanel (cyclomatic 19) apps/web/features/settings/center/import-preferences-panel.tsx:49 — import-preferences-panel.ImportPreferencesPanel has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 73, savePreferences, a function literal at line 141, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · presentation.submit_feedback (cyclomatic 18) · ×1
  • presentation.submit_feedback (cyclomatic 18) apps/api-python/app/modules/feedback/presentation.py:102 — presentation.submit_feedback 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 · ImportAttachmentUploads.target (cyclomatic 18) · ×1
  • ImportAttachmentUploads.target (cyclomatic 18) apps/api-python/app/modules/imports/infrastructure/automation_uploads.py:61 — ImportAttachmentUploads.target 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 · SqlAlchemyLibraryImportTaskQueue.continue_book_task (cyclomatic 18) · ×1
  • SqlAlchemyLibraryImportTaskQueue.continue_book_task (cyclomatic 18) apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:479 — SqlAlchemyLibraryImportTaskQueue.continue_book_task has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · file_moves.validate_move_set (cyclomatic 18) · ×1
  • file_moves.validate_move_set (cyclomatic 18) apps/api-python/app/modules/library/domain/file_moves.py:108 — file_moves.validate_move_set 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 · SqlAlchemyCatalogQueries._resource (cyclomatic 18) · ×1
  • SqlAlchemyCatalogQueries._resource (cyclomatic 18) apps/api-python/app/modules/library/infrastructure/catalog.py:238 — SqlAlchemyCatalogQueries._resource has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pdf_writeback.write_pdf_metadata (cyclomatic 18) · ×1
  • pdf_writeback.write_pdf_metadata (cyclomatic 18) apps/api-python/app/modules/metadata/infrastructure/pdf_writeback.py:152 — pdf_writeback.write_pdf_metadata 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 · epub_adapter._validated_entries (cyclomatic 18) · ×1
  • epub_adapter._validated_entries (cyclomatic 18) REDACTED:166 — epub_adapter._validated_entries 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 · install_plan.validate_prepared (cyclomatic 18) · ×1
  • install_plan.validate_prepared (cyclomatic 18) apps/api-python/app/modules/updates/infrastructure/install_plan.py:34 — install_plan.validate_prepared 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 · audio_metadata.parse_audio_metadata (cyclomatic 18) · ×1
  • audio_metadata.parse_audio_metadata (cyclomatic 18) apps/api-python/app/services/audio_metadata.py:178 — audio_metadata.parse_audio_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · audio_metadata._read_with_mutagen (cyclomatic 18) · ×1
  • audio_metadata._read_with_mutagen (cyclomatic 18) apps/api-python/app/services/audio_metadata.py:452 — audio_metadata._read_with_mutagen 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 · organize_service.douban_candidates (cyclomatic 18) · ×1
  • organize_service.douban_candidates (cyclomatic 18) REDACTED:268 — organize_service.douban_candidates has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AndroidAvatarSanitizer.sanitize (cyclomatic 18) · ×1
  • AndroidAvatarSanitizer.sanitize (cyclomatic 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/me/platform/AndroidMePlatform.kt:51 — AndroidAvatarSanitizer.sanitize 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 · ReaderActivity.onCreate (cyclomatic 18) · ×1
  • ReaderActivity.onCreate (cyclomatic 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:150 — ReaderActivity.onCreate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · BookContentNavigationKt.BookContentNavigation (cyclomatic 18) · ×1
  • BookContentNavigationKt.BookContentNavigation (cyclomatic 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/BookContentNavigation.kt:43 — BookContentNavigationKt.BookContentNavigation has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LoadBookContentKt.loadBookContent (cyclomatic 18) · ×1
  • LoadBookContentKt.loadBookContent (cyclomatic 18) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/application/LoadBookContent.kt:24 — LoadBookContentKt.loadBookContent 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 · AudioPlaybackRuntime.receive (cyclomatic 18) · ×1
  • AudioPlaybackRuntime.receive (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackRuntime.swift:408 — AudioPlaybackRuntime.receive has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · IosReaderPreferences.readium (cyclomatic 18) · ×1
  • IosReaderPreferences.readium (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:131 — IosReaderPreferences.readium has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · IosMobiPublicationPath.resourcePath (cyclomatic 18) · ×1
  • IosMobiPublicationPath.resourcePath (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiLazyContainer.swift:18 — IosMobiPublicationPath.resourcePath has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · IosPdfiumDownloadMaterializer.materialize (cyclomatic 18) · ×1
  • IosPdfiumDownloadMaterializer.materialize (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:30 — IosPdfiumDownloadMaterializer.materialize has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · IosPdfiumDocument.render (cyclomatic 18) · ×1
  • IosPdfiumDocument.render (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:326 — IosPdfiumDocument.render has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · NativeManagementSheet.body (cyclomatic 18) · ×1
  • NativeManagementSheet.body (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:886 — NativeManagementSheet.body has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkDetailView.detailActions (cyclomatic 18) · ×1
  • WorkDetailView.detailActions (cyclomatic 18) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:731 — WorkDetailView.detailActions has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · multi-value-combobox.MultiValueCombobox (cyclomatic 18) · ×1
  • multi-value-combobox.MultiValueCombobox (cyclomatic 18) apps/web/components/ui/multi-value-combobox.tsx:71 — multi-value-combobox.MultiValueCombobox has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (multi-value-combobox.MultiValueCombobox::onInputKeyDown) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · pwa-client.PwaDebugPanel (cyclomatic 18) · ×1
  • pwa-client.PwaDebugPanel (cyclomatic 18) apps/web/components/system/pwa-client.tsx:457 — pwa-client.PwaDebugPanel has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 620, 481, 495, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · input-router.readerKeyIntent (cyclomatic 18) · ×1
  • input-router.readerKeyIntent (cyclomatic 18) apps/web/features/reader/v3/input-router.ts:62 — input-router.readerKeyIntent has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · epub-archive-safety.preflightEpubArchiveEntries (cyclomatic 18) · ×1
  • epub-archive-safety.preflightEpubArchiveEntries (cyclomatic 18) apps/web/features/reader/v3/security/epub-archive-safety.ts:166 — epub-archive-safety.preflightEpubArchiveEntries 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 · reader-v3-page.OpeningCover (cyclomatic 18) · ×1
  • reader-v3-page.OpeningCover (cyclomatic 18) apps/web/features/reader/v3/reader-v3-page.tsx:109 — reader-v3-page.OpeningCover has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · problems.failure_problem (cyclomatic 17) · ×1
  • problems.failure_problem (cyclomatic 17) apps/api-python/app/modules/backup/infrastructure/problems.py:23 — problems.failure_problem 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 · ImportAttachmentUploads.progress (cyclomatic 17) · ×1
  • ImportAttachmentUploads.progress (cyclomatic 17) apps/api-python/app/modules/imports/infrastructure/automation_uploads.py:212 — ImportAttachmentUploads.progress 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 · metadata_patch.prepare_metadata_patch (cyclomatic 17) · ×1
  • metadata_patch.prepare_metadata_patch (cyclomatic 17) apps/api-python/app/modules/library/domain/metadata_patch.py:133 — metadata_patch.prepare_metadata_patch 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 · SqlAlchemyFileMoveIndex.apply (cyclomatic 17) · ×1
  • SqlAlchemyFileMoveIndex.apply (cyclomatic 17) apps/api-python/app/modules/library/infrastructure/file_move_index.py:73 — SqlAlchemyFileMoveIndex.apply 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 · FilesystemLocalMetadataCoverParser.extract_cover (cyclomatic 17) · ×1
  • FilesystemLocalMetadataCoverParser.extract_cover (cyclomatic 17) apps/api-python/app/modules/library/infrastructure/local_cover_regeneration.py:77 — FilesystemLocalMetadataCoverParser.extract_cover 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 · SqlAlchemyRecognizedMetadata.apply_changes (cyclomatic 17) · ×1
  • SqlAlchemyRecognizedMetadata.apply_changes (cyclomatic 17) apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:161 — SqlAlchemyRecognizedMetadata.apply_changes 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 · StandardMetadataPublication.inspect (cyclomatic 17) · ×1
  • StandardMetadataPublication.inspect (cyclomatic 17) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:119 — StandardMetadataPublication.inspect 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 · xml_policy._scan_entity_declarations (cyclomatic 17) · ×1
  • xml_policy._scan_entity_declarations (cyclomatic 17) REDACTED:299 — xml_policy._scan_entity_declarations 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 · UpdateShelf.execute (cyclomatic 17) · ×1
  • UpdateShelf.execute (cyclomatic 17) apps/api-python/app/modules/shelf/application/commands.py:179 — UpdateShelf.execute 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 · dependency_preparation.check_wheel_platform (cyclomatic 17) · ×1
  • dependency_preparation.check_wheel_platform (cyclomatic 17) apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:64 — dependency_preparation.check_wheel_platform 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 · metadata_file_writeback.process_next_metadata_writeback (cyclomatic 17) · ×1
  • metadata_file_writeback.process_next_metadata_writeback (cyclomatic 17) apps/api-python/app/services/metadata_file_writeback.py:295 — metadata_file_writeback.process_next_metadata_writeback 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 · organize_service.parse_douban_subject_html (cyclomatic 17) · ×1
  • organize_service.parse_douban_subject_html (cyclomatic 17) REDACTED:459 — organize_service.parse_douban_subject_html has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · BookDetailStore.loadContentBrowser (cyclomatic 17) · ×1
  • BookDetailStore.loadContentBrowser (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:919 — BookDetailStore.loadContentBrowser 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 · AdministrativeCopyCatalog.userFailure (cyclomatic 17) · ×1
  • AdministrativeCopyCatalog.userFailure (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsCopy.swift:83 — AdministrativeCopyCatalog.userFailure 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 · UserEditorView.body (cyclomatic 17) · ×1
  • UserEditorView.body (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:140 — UserEditorView.body 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 · DownloadCenterStore.awaitVerifiedReaderDownloadOperation (cyclomatic 17) · ×1
  • DownloadCenterStore.awaitVerifiedReaderDownloadOperation (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:287 — DownloadCenterStore.awaitVerifiedReaderDownloadOperation 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 · IosReflowableReaderSession.open (cyclomatic 17) · ×1
  • IosReflowableReaderSession.open (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:541 — IosReflowableReaderSession.open 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 · IosManagedPublicationStore.resolve (cyclomatic 17) · ×1
  • IosManagedPublicationStore.resolve (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosManagedPublicationStore.swift:238 — IosManagedPublicationStore.resolve 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 · WorkDetailView.observedScreen (cyclomatic 17) · ×1
  • WorkDetailView.observedScreen (cyclomatic 17) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:369 — WorkDetailView.observedScreen 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 · reader-safety-policy.rewriteReferences · ×1
  • reader-safety-policy.rewriteReferences::expandEntity (cyclomatic 17) apps/web/features/reader/v3/security/reader-safety-policy.ts:286 — reader-safety-policy.rewriteReferences::expandEntity 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 · multi-value-combobox.MultiValueCombobox · ×1
  • multi-value-combobox.MultiValueCombobox::onInputKeyDown (cyclomatic 17) apps/web/components/ui/multi-value-combobox.tsx:208 — multi-value-combobox.MultiValueCombobox::onInputKeyDown has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (multi-value-combobox.MultiValueCombobox) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · book-shelf-dialog.BookShelfDialog (cyclomatic 17) · ×1
  • book-shelf-dialog.BookShelfDialog (cyclomatic 17) apps/web/features/books/ui/book-shelf-dialog.tsx:11 — book-shelf-dialog.BookShelfDialog has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 5 function items inside it that branch (save, a function literal at line 33, a function literal at line 42, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · book-detail-page.ResourceEditor (cyclomatic 17) · ×1
  • book-detail-page.ResourceEditor (cyclomatic 17) apps/web/features/books/book-detail-page.tsx:127 — book-detail-page.ResourceEditor has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (save, a function literal at line 143). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · password-reset-pages.ResetPasswordPage (cyclomatic 17) · ×1
  • password-reset-pages.ResetPasswordPage (cyclomatic 17) apps/web/features/settings/password-reset-pages.tsx:82 — password-reset-pages.ResetPasswordPage has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (submit, a function literal at line 91). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · PdfRangeByteSource.fetchChunkGroup (cyclomatic 17) · ×1
  • PdfRangeByteSource.fetchChunkGroup (cyclomatic 17) apps/web/features/reader/v3/adapters/pdf-range-transport.ts:250 — PdfRangeByteSource.fetchChunkGroup 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 · directory-path-picker.DirectoryNodeRow (cyclomatic 17) · ×1
  • directory-path-picker.DirectoryNodeRow (cyclomatic 17) apps/web/features/settings/ui/directory-path-picker.tsx:311 — directory-path-picker.DirectoryNodeRow 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 · library-scan-settings-panel.LibraryScanSettingsPanel (cyclomatic 17) · ×1
  • library-scan-settings-panel.LibraryScanSettingsPanel (cyclomatic 17) apps/web/features/settings/center/library-scan-settings-panel.tsx:16 — library-scan-settings-panel.LibraryScanSettingsPanel has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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 · users._validate_preference (cyclomatic 16) · ×1
  • users._validate_preference (cyclomatic 16) apps/api-python/app/modules/auth/presentation/users.py:131 — users._validate_preference 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 · writeback_plans._destination (cyclomatic 16) · ×1
  • writeback_plans._destination (cyclomatic 16) apps/api-python/app/modules/automation/application/writeback_plans.py:66 — writeback_plans._destination 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 · ProcessReadableResourceImportTask.prepare_resource_covers (cyclomatic 16) · ×1
  • ProcessReadableResourceImportTask.prepare_resource_covers (cyclomatic 16) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1115 — ProcessReadableResourceImportTask.prepare_resource_covers 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 · ProcessReadableResourceImportTask.finalize_resource (cyclomatic 16) · ×1
  • ProcessReadableResourceImportTask.finalize_resource (cyclomatic 16) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1289 — ProcessReadableResourceImportTask.finalize_resource 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 · ResourcePreviewCache.prune (cyclomatic 16) · ×1
  • ResourcePreviewCache.prune (cyclomatic 16) apps/api-python/app/modules/media/infrastructure/resource_preview_cache.py:110 — ResourcePreviewCache.prune 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 · local_metadata._parse_local_metadata (cyclomatic 16) · ×1
  • local_metadata._parse_local_metadata (cyclomatic 16) apps/api-python/app/modules/metadata/application/local_metadata.py:166 — local_metadata._parse_local_metadata 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 · archive_writeback.preview_archive_metadata (cyclomatic 16) · ×1
  • archive_writeback.preview_archive_metadata (cyclomatic 16) apps/api-python/app/modules/metadata/infrastructure/archive_writeback.py:88 — archive_writeback.preview_archive_metadata 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 · file_writeback.cleanup_orphan_prepared_files (cyclomatic 16) · ×1
  • file_writeback.cleanup_orphan_prepared_files (cyclomatic 16) apps/api-python/app/modules/metadata/infrastructure/file_writeback.py:45 — file_writeback.cleanup_orphan_prepared_files 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 · pdf_writeback.patch_xmp (cyclomatic 16) · ×1
  • pdf_writeback.patch_xmp (cyclomatic 16) apps/api-python/app/modules/metadata/infrastructure/pdf_writeback.py:42 — pdf_writeback.patch_xmp 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 · fb2_adapter._render_element (cyclomatic 16) · ×1
  • fb2_adapter._render_element (cyclomatic 16) REDACTED:363 — fb2_adapter._render_element 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 · PublicationSnapshotCache.lease (cyclomatic 16) · ×1
  • PublicationSnapshotCache.lease (cyclomatic 16) apps/api-python/app/modules/publications/infrastructure/snapshot_cache.py:61 — PublicationSnapshotCache.lease 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 · SqlAlchemyReaderV5Repository.save_v5_progress (cyclomatic 16) · ×1
  • SqlAlchemyReaderV5Repository.save_v5_progress (cyclomatic 16) apps/api-python/app/modules/reader/infrastructure/v5_repository.py:215 — SqlAlchemyReaderV5Repository.save_v5_progress 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 · events.list_system_events_page (cyclomatic 16) · ×1
  • events.list_system_events_page (cyclomatic 16) apps/api-python/app/modules/system/infrastructure/events.py:168 — events.list_system_events_page 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 · OfficialReleases.releases (cyclomatic 16) · ×1
  • OfficialReleases.releases (cyclomatic 16) apps/api-python/app/modules/updates/infrastructure/official_source.py:109 — OfficialReleases.releases 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 · PreparationWorker._run (cyclomatic 16) · ×1
  • PreparationWorker._run (cyclomatic 16) apps/api-python/app/modules/updates/infrastructure/preparation_worker.py:262 — PreparationWorker._run 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 · audio_metadata._repair_misdecoded_text (cyclomatic 16) · ×1
  • audio_metadata._repair_misdecoded_text (cyclomatic 16) apps/api-python/app/services/audio_metadata.py:667 — audio_metadata._repair_misdecoded_text 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 · audio_metadata._normalize_audio_codec (cyclomatic 16) · ×1
  • audio_metadata._normalize_audio_codec (cyclomatic 16) apps/api-python/app/services/audio_metadata.py:875 — audio_metadata._normalize_audio_codec has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MetadataLookupWorker._run (cyclomatic 16) · ×1
  • MetadataLookupWorker._run (cyclomatic 16) REDACTED:1154 — MetadataLookupWorker._run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AdministrativeCoreScreensKt.EmailKindleSettingsScreen (cyclomatic 16) · ×1
  • AdministrativeCoreScreensKt.EmailKindleSettingsScreen (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt:158 — AdministrativeCoreScreensKt.EmailKindleSettingsScreen has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: AdministrativeCoreScreensKt.group (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AndroidAudioPlaybackRuntime.launchLocal (cyclomatic 16) · ×1
  • AndroidAudioPlaybackRuntime.launchLocal (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:197 — AndroidAudioPlaybackRuntime.launchLocal 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 · AudioPlayerUiKt.AudioNowPlayingScreen (cyclomatic 16) · ×1
  • AudioPlayerUiKt.AudioNowPlayingScreen (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:229 — AudioPlayerUiKt.AudioNowPlayingScreen 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 · WorkDetailViewModel.load (cyclomatic 16) · ×1
  • WorkDetailViewModel.load (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:506 — WorkDetailViewModel.load 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 · LibraryViewModel.loadScope (cyclomatic 16) · ×1
  • LibraryViewModel.loadScope (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/LibraryViewModel.kt:234 — LibraryViewModel.loadScope 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 · WorkDetailScreenKt.WorkIdentityText (cyclomatic 16) · ×1
  • WorkDetailScreenKt.WorkIdentityText (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:952 — WorkDetailScreenKt.WorkIdentityText has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · WorkDetailScreenKt.WorkContentEntryCard (cyclomatic 16) · ×1
  • WorkDetailScreenKt.WorkContentEntryCard (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1531 — WorkDetailScreenKt.WorkContentEntryCard 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 · EpubContentSecurityPolicy.prepareResourceBytes (cyclomatic 16) · ×1
  • EpubContentSecurityPolicy.prepareResourceBytes (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/EpubContentSecurityPolicy.kt:251 — EpubContentSecurityPolicy.prepareResourceBytes has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ReaderActivity.openServerReader (cyclomatic 16) · ×1
  • ReaderActivity.openServerReader (cyclomatic 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:502 — ReaderActivity.openServerReader has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · KtorAudioMediaTransportKt.validate (cyclomatic 16) · ×1
  • KtorAudioMediaTransportKt.validate (cyclomatic 16) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/infrastructure/KtorAudioMediaTransport.kt:109 — KtorAudioMediaTransportKt.validate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · KtorReaderBootstrapGateway.validateBeforeSecondaryRequest (cyclomatic 16) · ×1
  • KtorReaderBootstrapGateway.validateBeforeSecondaryRequest (cyclomatic 16) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:107 — KtorReaderBootstrapGateway.validateBeforeSecondaryRequest 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 · ServerBaseUrl.normalizeAuthority (cyclomatic 16) · ×1
  • ServerBaseUrl.normalizeAuthority (cyclomatic 16) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/servers/domain/ServerBaseUrl.kt:68 — ServerBaseUrl.normalizeAuthority 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 · KtorWorkManagementRepository.loadManagementSnapshot (cyclomatic 16) · ×1
  • KtorWorkManagementRepository.loadManagementSnapshot (cyclomatic 16) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/infrastructure/KtorWorkManagementRepository.kt:80 — KtorWorkManagementRepository.loadManagementSnapshot 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 · AudioPlaybackRuntime.execute (cyclomatic 16) · ×1
  • AudioPlaybackRuntime.execute (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackRuntime.swift:618 — AudioPlaybackRuntime.execute has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · DownloadCenterStore.executeManagement (cyclomatic 16) · ×1
  • DownloadCenterStore.executeManagement (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:138 — DownloadCenterStore.executeManagement 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 · DownloadCenterStore.executeApplicableManagementAction (cyclomatic 16) · ×1
  • DownloadCenterStore.executeApplicableManagementAction (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:367 — DownloadCenterStore.executeApplicableManagementAction 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 · IosMobiPublicationFactory.build (cyclomatic 16) · ×1
  • IosMobiPublicationFactory.build (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiPublicationFactory.swift:74 — IosMobiPublicationFactory.build 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 · IosReadiumRuntime.openEPUB (cyclomatic 16) · ×1
  • IosReadiumRuntime.openEPUB (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:97 — IosReadiumRuntime.openEPUB has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ShelfCatalogView.resultContent (cyclomatic 16) · ×1
  • ShelfCatalogView.resultContent (cyclomatic 16) apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/ShelfCatalogView.swift:93 — ShelfCatalogView.resultContent 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 · provider.I18nProvider (cyclomatic 16) · ×1
  • provider.I18nProvider (cyclomatic 16) apps/web/i18n/provider.tsx:120 — provider.I18nProvider has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 170, 145, 158, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · v5-wire.isJsonValue (cyclomatic 16) · ×1
  • v5-wire.isJsonValue (cyclomatic 16) apps/web/lib/reader/v5-wire.ts:88 — v5-wire.isJsonValue 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 · recognized-metadata.candidateMetadataValue (cyclomatic 16) · ×1
  • recognized-metadata.candidateMetadataValue (cyclomatic 16) apps/web/features/books/model/recognized-metadata.ts:54 — recognized-metadata.candidateMetadataValue 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 · metadata-lookup-modal.MetadataLookupModal · ×1
  • metadata-lookup-modal.MetadataLookupModal::applySelected (cyclomatic 16) apps/web/features/books/metadata-lookup-modal.tsx:242 — metadata-lookup-modal.MetadataLookupModal::applySelected has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (metadata-lookup-modal.MetadataLookupModal) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · readium-navigation.readiumTotalProgression (cyclomatic 16) · ×1
  • readium-navigation.readiumTotalProgression (cyclomatic 16) apps/web/features/reader/v3/adapters/readium-navigation.ts:184 — readium-navigation.readiumTotalProgression 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 · BrowserPublicationStore.download (cyclomatic 16) · ×1
  • BrowserPublicationStore.download (cyclomatic 16) apps/web/features/reader/v3/original-publication/browser-publication-store.ts:56 — BrowserPublicationStore.download 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 · paged-track-physics.resolvePagedTrackSettle (cyclomatic 16) · ×1
  • paged-track-physics.resolvePagedTrackSettle (cyclomatic 16) apps/web/features/reader/v3/paged-track/paged-track-physics.ts:107 — paged-track-physics.resolvePagedTrackSettle has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · pdf-layout.detectPdfCropBox (cyclomatic 16) · ×1
  • pdf-layout.detectPdfCropBox (cyclomatic 16) apps/web/features/reader/v3/adapters/pdf-layout.ts:9 — pdf-layout.detectPdfCropBox has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · backups-client.parseBackup (cyclomatic 16) · ×1
  • backups-client.parseBackup (cyclomatic 16) apps/web/features/settings/api/backups-client.ts:40 — backups-client.parseBackup 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 · shelves-page.ShelvesPage · ×1
  • shelves-page.ShelvesPage::openShelf (cyclomatic 16) apps/web/features/shelves/shelves-page.tsx:371 — shelves-page.ShelvesPage::openShelf has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (shelves-page.ShelvesPage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · generate-reader-safety-conformance.evaluateMarkupCase (cyclomatic 16) · ×1
  • generate-reader-safety-conformance.evaluateMarkupCase (cyclomatic 16) REDACTED:477 — generate-reader-safety-conformance.evaluateMarkupCase 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.
D10 · Test Quality · No assertions · ×1
  • No assertions: wake lock request rejection never blocks the reader lifecycle apps/web/features/reader/screen-wake-lock.test.ts:40 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D2 · Cognitive Complexity · reader-shell.ReaderShell (cognitive 309) · ×1
  • reader-shell.ReaderShell (cognitive 309) apps/web/features/reader/reader-shell.tsx:250 — reader-shell.ReaderShell has cognitive complexity 309 (threshold 15). Drivers by points: ternaries 95 (185 pts), if/else 73 (76 pts), boolean chains 48 (nesting depth added 93). Of this number, 169 points are the body's own statements and 140 belong to 40 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shelves-page.ShelvesPage (cognitive 244) · ×1
  • shelves-page.ShelvesPage (cognitive 244) apps/web/features/shelves/shelves-page.tsx:76 — shelves-page.ShelvesPage has cognitive complexity 244 (threshold 15). Drivers by points: ternaries 116 (292 pts), if/else 40 (45 pts), boolean chains 43, error handling 3, match/switch 1 (nesting depth added 181). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 2 other methods here (shelves-page.ShelvesPage::openShelf, shelves-page.ShelvesPage::saveShelf) 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 · audio-playback-provider.AudioPlaybackProvider (cognitive 228) · ×1
  • audio-playback-provider.AudioPlaybackProvider (cognitive 228) apps/web/features/audio/audio-playback-provider.tsx:166 — audio-playback-provider.AudioPlaybackProvider has cognitive complexity 228 (threshold 15). Drivers by points: if/else 97 (107 pts), boolean chains 55, ternaries 37 (53 pts), error handling 10 (12 pts), loops 1 (nesting depth added 28). Most of this is not in the body itself: 5 of the 228 points are its own statements and the rest belongs to 58 function literals inside it that branch (lines 337, 400, 821, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · app-shell.AppShell (cognitive 225) · ×1
  • app-shell.AppShell (cognitive 225) apps/web/components/layout/app-shell.tsx:143 — app-shell.AppShell has cognitive complexity 225 (threshold 15). Drivers by points: if/else 79 (99 pts), ternaries 49 (81 pts), boolean chains 45 (nesting depth added 52). Of this number, 49 points are the body's own statements and 176 belong to 56 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanLibrarySourceTree._walk (cognitive 192) · ×1
  • ScanLibrarySourceTree._walk (cognitive 192) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:575 — ScanLibrarySourceTree._walk has cognitive complexity 192 (threshold 15). Drivers by points: if/else 35 (112 pts), boolean chains 26, ternaries 8 (23 pts), loops 7 (20 pts), error handling 4 (11 pts) (nesting depth added 112). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProcessReadableResourceImportTask._execute_directory (cognitive 177) · ×1
  • ProcessReadableResourceImportTask._execute_directory (cognitive 177) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:715 — ProcessReadableResourceImportTask._execute_directory has cognitive complexity 177 (threshold 15). Drivers by points: if/else 41 (110 pts), loops 7 (22 pts), boolean chains 19, error handling 5 (19 pts), ternaries 4 (7 pts) (nesting depth added 101). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · generate-reader-safety-policy.validate_policy (cognitive 168) · ×1
  • generate-reader-safety-policy.validate_policy (cognitive 168) packages/reader-contracts/generate-reader-safety-policy.py:109 — generate-reader-safety-policy.validate_policy has cognitive complexity 168 (threshold 15). Drivers by points: if/else 70 (108 pts), boolean chains 49, loops 10 (11 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · library-page.LibraryPage (cognitive 153) · ×1
  • library-page.LibraryPage (cognitive 153) apps/web/features/library/library-page.tsx:75 — library-page.LibraryPage has cognitive complexity 153 (threshold 15). Drivers by points: ternaries 52 (90 pts), if/else 36, boolean chains 24, error handling 3 (nesting depth added 38). Of this number, 82 points are the body's own statements and 71 belong to 32 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update-operations.UpdateOperations (cognitive 136) · ×1
  • update-operations.UpdateOperations (cognitive 136) apps/web/features/updates/ui/update-operations.tsx:40 — update-operations.UpdateOperations has cognitive complexity 136 (threshold 15). Drivers by points: ternaries 40 (91 pts), boolean chains 37, if/else 8 (nesting depth added 51). Of this number, 122 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MultiDownloadSheetKt.MultiDownloadSheet (cognitive 132) · ×1
  • MultiDownloadSheetKt.MultiDownloadSheet (cognitive 132) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:99 — MultiDownloadSheetKt.MultiDownloadSheet has cognitive complexity 132 (threshold 15). Drivers by points: if/else 73 (105 pts), boolean chains 20, match/switch 6 (7 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · feedback-dialog.FeedbackDialog (cognitive 129) · ×1
  • feedback-dialog.FeedbackDialog (cognitive 129) REDACTED:71 — feedback-dialog.FeedbackDialog has cognitive complexity 129 (threshold 15). Drivers by points: ternaries 37 (62 pts), if/else 33 (41 pts), boolean chains 20, error handling 3, loops 3 (nesting depth added 33). Of this number, 54 points are the body's own statements and 75 belong to 21 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.main (cognitive 124) · ×1
  • main.main (cognitive 124) apps/api-python/app/worker/main.py:103 — main.main has cognitive complexity 124 (threshold 15). Drivers by points: if/else 26 (57 pts), ternaries 10 (30 pts), error handling 10 (24 pts), boolean chains 11, loops 2 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings-page.SettingsPage (cognitive 118) · ×1
  • settings-page.SettingsPage (cognitive 118) apps/web/features/settings/settings-page.tsx:54 — settings-page.SettingsPage has cognitive complexity 118 (threshold 15). Drivers by points: ternaries 31 (70 pts), if/else 29 (34 pts), boolean chains 8, error handling 5, loops 1 (nesting depth added 44). Of this number, 30 points are the body's own statements and 88 belong to 20 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DependencySet.validate_set (cognitive 115) · ×1
  • DependencySet.validate_set (cognitive 115) apps/api-python/app/modules/updates/application/dependency_release.py:61 — DependencySet.validate_set has cognitive complexity 115 (threshold 15). Drivers by points: if/else 32 (77 pts), boolean chains 27, loops 5 (6 pts), ternaries 1 (5 pts) (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 · audio-mini-player.AudioMiniPlayer (cognitive 109) · ×1
  • audio-mini-player.AudioMiniPlayer (cognitive 109) apps/web/components/audio/audio-mini-player.tsx:42 — audio-mini-player.AudioMiniPlayer has cognitive complexity 109 (threshold 15). Drivers by points: ternaries 49 (87 pts), boolean chains 14, if/else 8 (nesting depth added 38). Of this number, 81 points are the body's own statements and 28 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · target-directory-picker.TargetDirectoryPicker (cognitive 101) · ×1
  • target-directory-picker.TargetDirectoryPicker (cognitive 101) apps/web/components/directory/target-directory-picker.tsx:57 — target-directory-picker.TargetDirectoryPicker has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 29 (51 pts), if/else 23 (37 pts), boolean chains 11, error handling 2 (nesting depth added 36). Of this number, 41 points are the body's own statements and 60 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reader-engine-runtime.ReaderEngineRuntime (cognitive 100) · ×1
  • reader-engine-runtime.ReaderEngineRuntime (cognitive 100) apps/web/features/reader/v3/reader-engine-runtime.tsx:156 — reader-engine-runtime.ReaderEngineRuntime has cognitive complexity 100 (threshold 15). Drivers by points: if/else 36 (49 pts), ternaries 23 (30 pts), boolean chains 18, error handling 3 (nesting depth added 20). Most of this is not in the body itself: 9 of the 100 points are its own statements and the rest belongs to 27 function items inside it that branch (a function literal at line 547, a function literal at line 204, a function literal at line 620, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · BookManagementKt.ManagementPresentation (cognitive 99) · ×1
  • BookManagementKt.ManagementPresentation (cognitive 99) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/BookManagement.kt:328 — BookManagementKt.ManagementPresentation has cognitive complexity 99 (threshold 15). Drivers by points: if/else 39 (78 pts), boolean chains 12, match/switch 3 (9 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · selective_opf.patch_opf_metadata (cognitive 92) · ×1
  • selective_opf.patch_opf_metadata (cognitive 92) apps/api-python/app/modules/metadata/infrastructure/selective_opf.py:88 — selective_opf.patch_opf_metadata has cognitive complexity 92 (threshold 15). Drivers by points: if/else 18 (52 pts), ternaries 8 (28 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 59). 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 · automation-settings-page.AutomationSettingsPage (cognitive 90) · ×1
  • automation-settings-page.AutomationSettingsPage (cognitive 90) apps/web/features/automation/ui/automation-settings-page.tsx:184 — automation-settings-page.AutomationSettingsPage has cognitive complexity 90 (threshold 15). Drivers by points: ternaries 24 (82 pts), boolean chains 6, if/else 2 (nesting depth added 58). Of this number, 20 points are the body's own statements and 70 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · metadata-providers-panel.MetadataProvidersPanel (cognitive 90) · ×1
  • metadata-providers-panel.MetadataProvidersPanel (cognitive 90) apps/web/features/organize/metadata-providers-panel.tsx:62 — metadata-providers-panel.MetadataProvidersPanel has cognitive complexity 90 (threshold 15). Drivers by points: ternaries 28 (55 pts), if/else 16 (18 pts), boolean chains 13, error handling 4 (nesting depth added 29). Most of this is not in the body itself: 12 of the 90 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 219, a function literal at line 234, testProvider, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · readium-publication.openEpub (cognitive 86) · ×1
  • readium-publication.openEpub (cognitive 86) apps/web/features/reader/v3/adapters/readium-publication.ts:310 — readium-publication.openEpub has cognitive complexity 86 (threshold 15). Drivers by points: if/else 31 (52 pts), boolean chains 11, error handling 5 (11 pts), loops 5 (6 pts), ternaries 3 (6 pts) (nesting depth added 31). Of this number, 55 points are the body's own statements and 31 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProviderSourceNodeMetadataRecognition.search (cognitive 83) · ×1
  • ProviderSourceNodeMetadataRecognition.search (cognitive 83) apps/api-python/app/modules/metadata/infrastructure/source_node_recognition.py:48 — ProviderSourceNodeMetadataRecognition.search has cognitive complexity 83 (threshold 15). Drivers by points: if/else 23 (35 pts), boolean chains 22, ternaries 14 (18 pts), loops 3 (5 pts), error handling 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · directory-path-picker.DirectoryPathPicker (cognitive 83) · ×1
  • directory-path-picker.DirectoryPathPicker (cognitive 83) apps/web/features/settings/ui/directory-path-picker.tsx:13 — directory-path-picker.DirectoryPathPicker has cognitive complexity 83 (threshold 15). Drivers by points: ternaries 26 (42 pts), if/else 23 (30 pts), boolean chains 10, error handling 1 (nesting depth added 23). Of this number, 37 points are the body's own statements and 46 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata_lookup_queue.process_metadata_lookup_task (cognitive 82) · ×1
  • metadata_lookup_queue.process_metadata_lookup_task (cognitive 82) REDACTED:709 — metadata_lookup_queue.process_metadata_lookup_task has cognitive complexity 82 (threshold 15). Drivers by points: if/else 25 (37 pts), boolean chains 20, error handling 6 (13 pts), ternaries 7 (11 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosReaderComposition.bootstrap (cognitive 79) · ×1
  • IosReaderComposition.bootstrap (cognitive 79) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:177 — IosReaderComposition.bootstrap has cognitive complexity 79 (threshold 15). Drivers by points: if/else 33 (55 pts), ternaries 5 (10 pts), boolean chains 9, error handling 3 (5 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dependency_preparation.verify_dependency_artifact (cognitive 78) · ×1
  • dependency_preparation.verify_dependency_artifact (cognitive 78) apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:110 — dependency_preparation.verify_dependency_artifact has cognitive complexity 78 (threshold 15). Drivers by points: if/else 22 (59 pts), boolean chains 13, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MainShellKt.MainShell (cognitive 77) · ×1
  • MainShellKt.MainShell (cognitive 77) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:218 — MainShellKt.MainShell has cognitive complexity 77 (threshold 15). Drivers by points: if/else 46 (51 pts), boolean chains 14, loops 5 (11 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExecuteFileMoveOperation.execute (cognitive 75) · ×1
  • ExecuteFileMoveOperation.execute (cognitive 75) apps/api-python/app/modules/library/application/execute_file_moves.py:86 — ExecuteFileMoveOperation.execute has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (52 pts), boolean chains 6, loops 3 (6 pts), ternaries 2 (6 pts), error handling 2 (5 pts) (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · book-detail-page.BookDetailPage (cognitive 75) · ×1
  • book-detail-page.BookDetailPage (cognitive 75) apps/web/features/books/book-detail-page.tsx:189 — book-detail-page.BookDetailPage has cognitive complexity 75 (threshold 15). Drivers by points: ternaries 57 (83 pts), if/else 51 (58 pts), boolean chains 32, error handling 3 (nesting depth added 33). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (book-detail-page.BookDetailPage::invokeResourceAction, book-detail-page.BookDetailPage::invokeSourceNodeAction) 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 · reader-v3-page.ReaderV5Page (cognitive 72) · ×1
  • reader-v3-page.ReaderV5Page (cognitive 72) apps/web/features/reader/v3/reader-v3-page.tsx:228 — reader-v3-page.ReaderV5Page has cognitive complexity 72 (threshold 15). Drivers by points: if/else 32 (35 pts), ternaries 15 (22 pts), boolean chains 13, error handling 2 (nesting depth added 10). Most of this is not in the body itself: 7 of the 72 points are its own statements and the rest belongs to 18 function literals inside it that branch (lines 292, 370, 474, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · users-permissions-page.UsersPermissionsPage (cognitive 72) · ×1
  • users-permissions-page.UsersPermissionsPage (cognitive 72) apps/web/features/settings/center/users-permissions-page.tsx:88 — users-permissions-page.UsersPermissionsPage has cognitive complexity 72 (threshold 15). Drivers by points: ternaries 36 (47 pts), boolean chains 12, if/else 7 (8 pts), error handling 5 (nesting depth added 12). Of this number, 23 points are the body's own statements and 49 belong to 7 function items inside it that branch. 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 · resource-detail-view.ResourceDetailView (cognitive 69) · ×1
  • resource-detail-view.ResourceDetailView (cognitive 69) apps/web/features/books/ui/resource-detail-view.tsx:75 — resource-detail-view.ResourceDetailView has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 33 (53 pts), boolean chains 16 (nesting depth added 20). Of this number, 41 points are the body's own statements and 28 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · writeback_queue.prepare_targets_from_snapshot (cognitive 68) · ×1
  • writeback_queue.prepare_targets_from_snapshot (cognitive 68) apps/api-python/app/modules/metadata/infrastructure/writeback_queue.py:749 — writeback_queue.prepare_targets_from_snapshot has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 12 (29 pts), if/else 9 (21 pts), boolean chains 8, loops 4 (7 pts), error handling 1 (3 pts) (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 · metadata_lookup_queue._prepare_candidate_application (cognitive 68) · ×1
  • metadata_lookup_queue._prepare_candidate_application (cognitive 68) REDACTED:319 — metadata_lookup_queue._prepare_candidate_application has cognitive complexity 68 (threshold 15). Drivers by points: boolean chains 40, if/else 14 (16 pts), ternaries 6 (7 pts), error handling 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · library-batch-actions.LibraryBatchDialog (cognitive 67) · ×1
  • library-batch-actions.LibraryBatchDialog (cognitive 67) apps/web/features/library/library-batch-actions.tsx:144 — library-batch-actions.LibraryBatchDialog has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 46 (90 pts), boolean chains 21, if/else 16 (19 pts), error handling 2 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (library-batch-actions.LibraryBatchDialog::submit) 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 · reader-engine-runtime.readerErrorMessage (cognitive 66) · ×1
  • reader-engine-runtime.readerErrorMessage (cognitive 66) apps/web/features/reader/v3/reader-engine-runtime.tsx:76 — reader-engine-runtime.readerErrorMessage has cognitive complexity 66 (threshold 15). Drivers by points: if/else 61, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ProcessReadableResourceImportTask._process_prepared_resource (cognitive 61) · ×1
  • ProcessReadableResourceImportTask._process_prepared_resource (cognitive 61) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:360 — ProcessReadableResourceImportTask._process_prepared_resource has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 5 (13 pts), boolean chains 11, ternaries 7 (11 pts), error handling 3 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http_streaming._file_response (cognitive 61) · ×1
  • http_streaming._file_response (cognitive 61) apps/api-python/app/modules/media/infrastructure/http_streaming.py:725 — http_streaming._file_response has cognitive complexity 61 (threshold 15). Drivers by points: if/else 28 (48 pts), boolean chains 9, error handling 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · book_list.list_books (cognitive 59) · ×1
  • book_list.list_books (cognitive 59) apps/api-python/app/modules/library/infrastructure/book_list.py:411 — book_list.list_books has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 14 (20 pts), boolean chains 11 (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 · ApplyRecognizedMetadata.execute (cognitive 58) · ×1
  • ApplyRecognizedMetadata.execute (cognitive 58) apps/api-python/app/modules/library/application/recognized_metadata.py:412 — ApplyRecognizedMetadata.execute has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 6 (16 pts), boolean chains 8, error handling 3 (5 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · management-logs-page.ManagementLogsPage (cognitive 58) · ×1
  • management-logs-page.ManagementLogsPage (cognitive 58) apps/web/features/management/management-logs-page.tsx:99 — management-logs-page.ManagementLogsPage has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 24 (30 pts), if/else 12, boolean chains 11, error handling 5 (nesting depth added 6). Most of this is not in the body itself: 13 of the 58 points are its own statements and the rest belongs to 12 function items inside it that branch (clearLogs, saveLogLimit, a function literal at line 317, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · OsSourceTreeFilesystem.probe_directory (cognitive 57) · ×1
  • OsSourceTreeFilesystem.probe_directory (cognitive 57) apps/api-python/app/modules/imports/infrastructure/readable_resource/filesystem.py:131 — OsSourceTreeFilesystem.probe_directory has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (40 pts), ternaries 3 (6 pts), boolean chains 4, error handling 2 (4 pts), loops 2 (3 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 · ShelfCatalogScreenKt.ShelfCatalogScreen (cognitive 57) · ×1
  • ShelfCatalogScreenKt.ShelfCatalogScreen (cognitive 57) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shelves/ui/ShelfCatalogScreen.kt:81 — ShelfCatalogScreenKt.ShelfCatalogScreen has cognitive complexity 57 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 4, match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · combobox.Combobox (cognitive 57) · ×1
  • combobox.Combobox (cognitive 57) apps/web/components/ui/combobox.tsx:33 — combobox.Combobox has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 16 (32 pts), if/else 14 (17 pts), boolean chains 8 (nesting depth added 19). Most of this is not in the body itself: 13 of the 57 points are its own statements and the rest belongs to 11 function items inside it that branch (onKeyDown, a function literal at line 199, a function literal at line 81, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · PdfReaderAdapter.execute (cognitive 57) · ×1
  • PdfReaderAdapter.execute (cognitive 57) apps/web/features/reader/v3/adapters/pdf-adapter.ts:367 — PdfReaderAdapter.execute has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (35 pts), boolean chains 9, ternaries 3 (9 pts), error handling 3 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · archive.extract_package (cognitive 56) · ×1
  • archive.extract_package (cognitive 56) apps/api-python/app/modules/updates/infrastructure/archive.py:137 — archive.extract_package has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (31 pts), ternaries 6 (13 pts), boolean chains 7, loops 3, error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 0037_single_import_execution.upgrade (cognitive 55) · ×1
  • 0037_single_import_execution.upgrade (cognitive 55) apps/api-python/app/db/alembic/versions/0037_single_import_execution.py:51 — 0037_single_import_execution.upgrade has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 10, ternaries 2 (6 pts), error handling 1 (3 pts), loops 1 (nesting depth added 27). 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 · ProcessReadableResourceImportTask._refresh_single_file_metadata (cognitive 55) · ×1
  • ProcessReadableResourceImportTask._refresh_single_file_metadata (cognitive 55) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:593 — ProcessReadableResourceImportTask._refresh_single_file_metadata has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (40 pts), boolean chains 12, loops 1 (2 pts), ternaries 1 (nesting depth added 24). 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 · email-settings-page.EmailSettingsPage (cognitive 55) · ×1
  • email-settings-page.EmailSettingsPage (cognitive 55) apps/web/features/settings/center/email-settings-page.tsx:64 — email-settings-page.EmailSettingsPage has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 17 (30 pts), boolean chains 10, if/else 10, error handling 5 (nesting depth added 13). Of this number, 20 points are the body's own statements and 35 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · import-tasks-page.ImportTasksPage (cognitive 54) · ×1
  • import-tasks-page.ImportTasksPage (cognitive 54) apps/web/features/import-tasks/import-tasks-page.tsx:94 — import-tasks-page.ImportTasksPage has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 24 (28 pts), if/else 13 (15 pts), boolean chains 9, error handling 2 (nesting depth added 6). Most of this is not in the body itself: 14 of the 54 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 143, a function literal at line 317, continueTask, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · book-table.BookTable (cognitive 54) · ×1
  • book-table.BookTable (cognitive 54) apps/web/components/book/book-table.tsx:25 — book-table.BookTable has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 22 (28 pts), if/else 17, boolean chains 9 (nesting depth added 6). Most of this is not in the body itself: 4 of the 54 points are its own statements and the rest belongs to 12 function items inside it that branch (sortableHeader, a function literal at line 221, beginRowSelection, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · setup-page.SetupPage (cognitive 54) · ×1
  • setup-page.SetupPage (cognitive 54) apps/web/features/settings/setup-page.tsx:37 — setup-page.SetupPage has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (25 pts), ternaries 9 (13 pts), boolean chains 10, error handling 5 (6 pts) (nesting depth added 9). Most of this is not in the body itself: 6 of the 54 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 53, createAccount, addLibrary, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ScanLibrarySourceTree._execute_scopes (cognitive 53) · ×1
  • ScanLibrarySourceTree._execute_scopes (cognitive 53) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:336 — ScanLibrarySourceTree._execute_scopes has cognitive complexity 53 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 4 (11 pts), boolean chains 8, ternaries 3 (7 pts), loops 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegistryResourceAdapterExecutor.parse_file (cognitive 53) · ×1
  • RegistryResourceAdapterExecutor.parse_file (cognitive 53) REDACTED:214 — RegistryResourceAdapterExecutor.parse_file has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 13 (17 pts), if/else 10 (16 pts), error handling 5 (11 pts), boolean chains 9 (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 · pwa-client.PwaClient (cognitive 53) · ×1
  • pwa-client.PwaClient (cognitive 53) apps/web/components/system/pwa-client.tsx:79 — pwa-client.PwaClient has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (35 pts), boolean chains 13, ternaries 3, error handling 2 (nesting depth added 9). Most of this is not in the body itself: 3 of the 53 points are its own statements and the rest belongs to 21 function items inside it that branch (a function literal at line 172, a function literal at line 132, a function literal at line 167, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · records.installed_records (cognitive 52) · ×1
  • records.installed_records (cognitive 52) apps/api-python/shuku_dependencies/records.py:18 — records.installed_records has cognitive complexity 52 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 7, loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderScreen (cognitive 52) · ×1
  • ReaderScreenKt.ReaderScreen (cognitive 52) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:201 — ReaderScreenKt.ReaderScreen has cognitive complexity 52 (threshold 15). Drivers by points: if/else 32 (36 pts), error handling 4 (8 pts), boolean chains 5, match/switch 3 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · reader-safety-policy.findDoctype (cognitive 52) · ×1
  • reader-safety-policy.findDoctype (cognitive 52) apps/web/features/reader/v3/security/reader-safety-policy.ts:96 — reader-safety-policy.findDoctype has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (38 pts), ternaries 3 (8 pts), boolean chains 3, loops 2 (3 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 · selective_comicinfo.patch_comicinfo (cognitive 51) · ×1
  • selective_comicinfo.patch_comicinfo (cognitive 51) apps/api-python/app/modules/metadata/infrastructure/selective_comicinfo.py:26 — selective_comicinfo.patch_comicinfo has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 4 (12 pts), loops 3 (6 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderContentsPanel (cognitive 51) · ×1
  • ReaderScreenKt.ReaderContentsPanel (cognitive 51) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:2116 — ReaderScreenKt.ReaderContentsPanel has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (41 pts), boolean chains 8, match/switch 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http.update_shelf (cognitive 50) · ×1
  • http.update_shelf (cognitive 50) apps/api-python/app/modules/shelf/presentation/http.py:727 — http.update_shelf has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (32 pts), ternaries 8 (9 pts), boolean chains 6, error handling 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 · generate-reader-safety-policy.validate_fixture_manifest (cognitive 50) · ×1
  • generate-reader-safety-policy.validate_fixture_manifest (cognitive 50) packages/reader-contracts/generate-reader-safety-policy.py:568 — generate-reader-safety-policy.validate_fixture_manifest has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 14, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verify-reader-safety-conformance.load_suite_and_expected (cognitive 49) · ×1
  • verify-reader-safety-conformance.load_suite_and_expected (cognitive 49) packages/reader-contracts/verify-reader-safety-conformance.py:222 — verify-reader-safety-conformance.load_suite_and_expected has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (43 pts), loops 5, 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 · IosEpubArchiveSafetyPreflight.verifyMetadata (cognitive 49) · ×1
  • IosEpubArchiveSafetyPreflight.verifyMetadata (cognitive 49) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:91 — IosEpubArchiveSafetyPreflight.verifyMetadata has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 5 (14 pts), boolean chains 9, loops 3 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · select.Select (cognitive 48) · ×1
  • select.Select (cognitive 48) apps/web/components/ui/select.tsx:86 — select.Select has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 17 (25 pts), if/else 12 (14 pts), boolean chains 9 (nesting depth added 10). Most of this is not in the body itself: 10 of the 48 points are its own statements and the rest belongs to 10 function items inside it that branch (onKeyDown, a function literal at line 248, a function literal at line 143, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · move_companions.move_companion_paths (cognitive 47) · ×1
  • move_companions.move_companion_paths (cognitive 47) apps/api-python/app/modules/library/infrastructure/move_companions.py:26 — move_companions.move_companion_paths has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts), ternaries 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 · ComicReaderAdapter.execute (cognitive 47) · ×1
  • ComicReaderAdapter.execute (cognitive 47) apps/web/features/reader/v3/adapters/comic-adapter.ts:317 — ComicReaderAdapter.execute has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 9, ternaries 3 (7 pts), error handling 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · system-health-settings-page.SystemHealthSettingsPage (cognitive 47) · ×1
  • system-health-settings-page.SystemHealthSettingsPage (cognitive 47) apps/web/features/settings/center/system-health-settings-page.tsx:110 — system-health-settings-page.SystemHealthSettingsPage has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 15 (20 pts), if/else 13 (15 pts), boolean chains 11, error handling 1 (nesting depth added 7). Most of this is not in the body itself: 14 of the 47 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 198, execute, a function literal at line 286, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · BookManagementKt.ManagementAnchor (cognitive 46) · ×1
  • BookManagementKt.ManagementAnchor (cognitive 46) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/BookManagement.kt:150 — BookManagementKt.ManagementAnchor has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 19, loops 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · provider.translateDomNode (cognitive 46) · ×1
  • provider.translateDomNode (cognitive 46) apps/web/i18n/provider.tsx:70 — provider.translateDomNode has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (38 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 27). 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 · reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile (cognitive 46) · ×1
  • reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile (cognitive 46) apps/web/features/reader/v3/security/reader-safety-policy.ts:699 — reader-safety-policy.rewriteAuthoredDocumentReferencesWithProfile has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 4 (5 pts), boolean chains 4, match/switch 1 (3 pts), ternaries 2 (nesting depth added 20). Of this number, 29 points are the body's own statements and 17 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · text-publication.worker.materializeFb2Chapter (cognitive 46) · ×1
  • text-publication.worker.materializeFb2Chapter (cognitive 46) apps/web/features/reader/v3/original-publication/text-publication.worker.ts:108 — text-publication.worker.materializeFb2Chapter has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (33 pts), ternaries 2 (7 pts), boolean chains 5, 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 · WorkDetailViewModel.loadMultiDownloadFolder (cognitive 45) · ×1
  • WorkDetailViewModel.loadMultiDownloadFolder (cognitive 45) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:682 — WorkDetailViewModel.loadMultiDownloadFolder has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (40 pts), error handling 2, match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderPreferenceChangesKt.changedReaderControls (cognitive 45) · ×1
  • ReaderPreferenceChangesKt.changedReaderControls (cognitive 45) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderPreferenceChanges.kt:70 — ReaderPreferenceChangesKt.changedReaderControls has cognitive complexity 45 (threshold 15). Drivers by points: if/else 44 (45 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · dashboard-page.DashboardPage (cognitive 45) · ×1
  • dashboard-page.DashboardPage (cognitive 45) apps/web/features/dashboard/dashboard-page.tsx:40 — dashboard-page.DashboardPage has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 13 (34 pts), if/else 7 (11 pts) (nesting depth added 25). Most of this is not in the body itself: 10 of the 45 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 131, 58, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · automation-settings-page.GrantsPanel (cognitive 45) · ×1
  • automation-settings-page.GrantsPanel (cognitive 45) apps/web/features/automation/ui/automation-settings-page.tsx:148 — automation-settings-page.GrantsPanel has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 14 (24 pts), boolean chains 13, if/else 5 (8 pts) (nesting depth added 13). Most of this is not in the body itself: 8 of the 45 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 161, a function literal at line 157, formatTime, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · FileDeletions.execute (cognitive 43) · ×1
  • FileDeletions.execute (cognitive 43) apps/api-python/app/modules/library/application/file_deletions.py:146 — FileDeletions.execute has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (30 pts), error handling 2 (5 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http.get_cover (cognitive 43) · ×1
  • http.get_cover (cognitive 43) apps/api-python/app/modules/media/presentation/http.py:273 — http.get_cover has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 11, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XmlControlPreprocessor.expandInternalEntity (cognitive 43) · ×1
  • XmlControlPreprocessor.expandInternalEntity (cognitive 43) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:752 — XmlControlPreprocessor.expandInternalEntity has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BookDetailStore.loadContentBrowser (cognitive 43) · ×1
  • BookDetailStore.loadContentBrowser (cognitive 43) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:919 — BookDetailStore.loadContentBrowser has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (39 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosImageDirectoryBundle.init (cognitive 43) · ×1
  • IosImageDirectoryBundle.init (cognitive 43) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosImageDirectoryPublicationFactory.swift:19 — IosImageDirectoryBundle.init has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 21, if/else 12 (20 pts), loops 2 (nesting depth added 8). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · organize-page.OrganizePage (cognitive 43) · ×1
  • organize-page.OrganizePage (cognitive 43) apps/web/features/organize/organize-page.tsx:200 — organize-page.OrganizePage has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 18 (25 pts), if/else 9, boolean chains 7, error handling 2 (nesting depth added 7). Of this number, 16 points are the body's own statements and 27 belong to 4 function items inside it that branch. 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 · ReadableResourceWorkerProcessor._execute_book (cognitive 42) · ×1
  • ReadableResourceWorkerProcessor._execute_book (cognitive 42) apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py:246 — ReadableResourceWorkerProcessor._execute_book has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBulkBookOperations.prepare_covers (cognitive 42) · ×1
  • SqlAlchemyBulkBookOperations.prepare_covers (cognitive 42) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:881 — SqlAlchemyBulkBookOperations.prepare_covers has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 7 (13 pts), error handling 4 (7 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_writeback.write_audio_metadata (cognitive 42) · ×1
  • audio_writeback.write_audio_metadata (cognitive 42) apps/api-python/app/modules/metadata/infrastructure/audio_writeback.py:90 — audio_writeback.write_audio_metadata has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 6 (14 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · api.fetchReaderBootstrap (cognitive 42) · ×1
  • api.fetchReaderBootstrap (cognitive 42) apps/web/features/reader/v3/api.ts:255 — api.fetchReaderBootstrap has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 15, ternaries 7 (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 · strict-fb2-parser.parseStrictFb2.openElement (cognitive 42) · ×1
  • strict-fb2-parser.parseStrictFb2.openElement (cognitive 42) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:305 — strict-fb2-parser.parseStrictFb2.openElement has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 10, ternaries 1 (nesting depth added 10). Of this number, 34 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 0031_book_import_task_backfill.backfill_book_tasks (cognitive 41) · ×1
  • 0031_book_import_task_backfill.backfill_book_tasks (cognitive 41) apps/api-python/app/db/alembic/versions/0031_book_import_task_backfill.py:168 — 0031_book_import_task_backfill.backfill_book_tasks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (19 pts), ternaries 5 (13 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegistryResourceAdapterExecutor._epub_navigation (cognitive 41) · ×1
  • RegistryResourceAdapterExecutor._epub_navigation (cognitive 41) REDACTED:483 — RegistryResourceAdapterExecutor._epub_navigation has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · organize_service.bangumi_candidates (cognitive 41) · ×1
  • organize_service.bangumi_candidates (cognitive 41) REDACTED:828 — organize_service.bangumi_candidates has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 12 (18 pts), if/else 7 (16 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CentralDirectoryReader.read (cognitive 41) · ×1
  • CentralDirectoryReader.read (cognitive 41) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:424 — CentralDirectoryReader.read has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 13, 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 · http.create_kindle_send_task (cognitive 40) · ×1
  • http.create_kindle_send_task (cognitive 40) apps/api-python/app/modules/kindle/presentation/http.py:327 — http.create_kindle_send_task has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 15, ternaries 3, error handling 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · packages.node_packages (cognitive 40) · ×1
  • packages.node_packages (cognitive 40) apps/api-python/shuku_dependencies/packages.py:135 — packages.node_packages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 3 (6 pts), boolean chains 5, loops 4 (5 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 · WorkDetailScreenKt.WorkDetailScreen (cognitive 40) · ×1
  • WorkDetailScreenKt.WorkDetailScreen (cognitive 40) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:206 — WorkDetailScreenKt.WorkDetailScreen has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (33 pts), boolean chains 3, loops 1 (2 pts), match/switch 2 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · client.readerResourceFailure (cognitive 40) · ×1
  • client.readerResourceFailure (cognitive 40) apps/web/features/reader/api/client.ts:28 — client.readerResourceFailure has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 8 (36 pts), boolean chains 3, error handling 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · (anonymous) (cognitive 40) · ×1
  • (anonymous) (cognitive 40) prototypes/feedback-web/prototype.js:335 — (anonymous) has cognitive complexity 40 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AutomationUploads.complete (cognitive 39) · ×1
  • AutomationUploads.complete (cognitive 39) apps/api-python/app/modules/automation/application/uploads.py:329 — AutomationUploads.complete has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 8, ternaries 3 (6 pts), error handling 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBulkBookOperations.update_metadata (cognitive 39) · ×1
  • SqlAlchemyBulkBookOperations.update_metadata (cognitive 39) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:341 — SqlAlchemyBulkBookOperations.update_metadata has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 12, loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBookResourceRepository.save_directory_assets (cognitive 39) · ×1
  • SqlAlchemyBookResourceRepository.save_directory_assets (cognitive 39) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1400 — SqlAlchemyBookResourceRepository.save_directory_assets has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 7 (12 pts), loops 6 (10 pts), boolean chains 5 (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 · generation.complete_missing_metadata (cognitive 39) · ×1
  • generation.complete_missing_metadata (cognitive 39) apps/api-python/app/modules/metadata/infrastructure/generation.py:29 — generation.complete_missing_metadata has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 14, ternaries 2 (3 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · matching.match_metadata_candidates (cognitive 39) · ×1
  • matching.match_metadata_candidates (cognitive 39) apps/api-python/app/modules/metadata/infrastructure/matching.py:147 — matching.match_metadata_candidates has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 21, if/else 9 (10 pts), ternaries 5 (6 pts), loops 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AnchoredStandardMetadataReader._read_one (cognitive 39) · ×1
  • AnchoredStandardMetadataReader._read_one (cognitive 39) apps/api-python/app/modules/metadata/infrastructure/standard_files.py:187 — AnchoredStandardMetadataReader._read_one has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 6 (10 pts), ternaries 5 (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 · classification-management-panel.ClassificationManagementPanel (cognitive 39) · ×1
  • classification-management-panel.ClassificationManagementPanel (cognitive 39) apps/web/features/organize/classification-management-panel.tsx:24 — classification-management-panel.ClassificationManagementPanel has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 14 (23 pts), if/else 7 (8 pts), boolean chains 4, error handling 4 (nesting depth added 10). Most of this is not in the body itself: 11 of the 39 points are its own statements and the rest belongs to 10 function items inside it that branch (rename, merge, removeCategory, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · epub_adapter._index_epub (cognitive 38) · ×1
  • epub_adapter._index_epub (cognitive 38) REDACTED:417 — epub_adapter._index_epub has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 6 (8 pts), boolean chains 6, ternaries 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShelfCatalogView.resultContent (cognitive 38) · ×1
  • ShelfCatalogView.resultContent (cognitive 38) apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/ShelfCatalogView.swift:93 — ShelfCatalogView.resultContent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 5 (17 pts), match/switch 1 (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · prototype.app.addEventListener("click") (cognitive 38) · ×1
  • prototype.app.addEventListener("click") (cognitive 38) prototypes/feedback-web/prototype.js:335 — prototype.app.addEventListener("click") has cognitive complexity 38 (threshold 15). Drivers by points: if/else 31 (35 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ProcessBookResources.execute (cognitive 37) · ×1
  • ProcessBookResources.execute (cognitive 37) apps/api-python/app/modules/imports/application/readable_resource/process_book_resources.py:133 — ProcessBookResources.execute has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 9, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdministrativePeopleAndQueueScreensKt.UserEditScreen (cognitive 37) · ×1
  • AdministrativePeopleAndQueueScreensKt.UserEditScreen (cognitive 37) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativePeopleAndQueueScreens.kt:234 — AdministrativePeopleAndQueueScreensKt.UserEditScreen has cognitive complexity 37 (threshold 15). Drivers by points: if/else 27 (33 pts), boolean chains 4 (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 · context-action-menu.ContextActionMenu (cognitive 37) · ×1
  • context-action-menu.ContextActionMenu (cognitive 37) apps/web/components/ui/context-action-menu.tsx:24 — context-action-menu.ContextActionMenu has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 20 (25 pts), if/else 9, boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 8 of the 37 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 129, 65, 52, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · book-action-controller.BookActionController · ×1
  • book-action-controller.BookActionController::invoke (cognitive 37) apps/web/features/books/ui/book-action-controller.tsx:109 — book-action-controller.BookActionController::invoke has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 2 (4 pts), boolean chains 3, error handling 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 · account-panel.AccountPanel (cognitive 37) · ×1
  • account-panel.AccountPanel (cognitive 37) apps/web/features/settings/center/account-panel.tsx:32 — account-panel.AccountPanel has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12, ternaries 7 (12 pts), boolean chains 8, error handling 5 (nesting depth added 5). Most of this is not in the body itself: 5 of the 37 points are its own statements and the rest belongs to 7 function items inside it that branch (uploadAvatar, savePassword, saveName, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · filter_ast.parse_filter_expression (cognitive 36) · ×1
  • filter_ast.parse_filter_expression (cognitive 36) apps/api-python/app/modules/library/application/filter_ast.py:100 — filter_ast.parse_filter_expression has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, ternaries 1 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · file_writeback._publication (cognitive 36) · ×1
  • file_writeback._publication (cognitive 36) apps/api-python/app/modules/metadata/infrastructure/file_writeback.py:110 — file_writeback._publication has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 20, ternaries 7 (8 pts), if/else 5 (6 pts), error handling 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · library_filters.normalize_filter_rules (cognitive 36) · ×1
  • library_filters.normalize_filter_rules (cognitive 36) apps/api-python/app/services/library_filters.py:52 — library_filters.normalize_filter_rules has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, ternaries 1 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidEpubArchiveSafetyPreflight.verifyMetadata (cognitive 36) · ×1
  • AndroidEpubArchiveSafetyPreflight.verifyMetadata (cognitive 36) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidEpubArchiveSafetyPreflight.kt:72 — AndroidEpubArchiveSafetyPreflight.verifyMetadata has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 9, 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 · ApiClient.execute (cognitive 36) · ×1
  • ApiClient.execute (cognitive 36) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:162 — ApiClient.execute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, error handling 4, match/switch 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · book-content-browser.BookContentBrowser (cognitive 36) · ×1
  • book-content-browser.BookContentBrowser (cognitive 36) apps/web/features/books/ui/book-content-browser.tsx:75 — book-content-browser.BookContentBrowser has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 17 (23 pts), boolean chains 13 (nesting depth added 6). Of this number, 21 points are the body's own statements and 15 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mobi-publication.openMobiPublication (cognitive 36) · ×1
  • mobi-publication.openMobiPublication (cognitive 36) apps/web/features/reader/v3/original-publication/mobi-publication.ts:93 — mobi-publication.openMobiPublication has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (20 pts), loops 4 (5 pts), ternaries 3 (5 pts), boolean chains 4, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 12 of the 36 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 185, a function literal at line 135, a function literal at line 152, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · strict-fb2-parser.namespacesForElement (cognitive 36) · ×1
  • strict-fb2-parser.namespacesForElement (cognitive 36) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:180 — strict-fb2-parser.namespacesForElement has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, ternaries 3 (7 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · library_paths.library_directory_tree_node (cognitive 35) · ×1
  • library_paths.library_directory_tree_node (cognitive 35) apps/api-python/app/modules/imports/application/library_paths.py:45 — library_paths.library_directory_tree_node has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 9, error handling 3 (6 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkDetailScreenKt.WorkDetailBody (cognitive 35) · ×1
  • WorkDetailScreenKt.WorkDetailBody (cognitive 35) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:520 — WorkDetailScreenKt.WorkDetailBody has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23 (27 pts), boolean chains 8 (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 · ReadiumEpubSession.openLocalPublication (cognitive 35) · ×1
  • ReadiumEpubSession.openLocalPublication (cognitive 35) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:211 — ReadiumEpubSession.openLocalPublication has cognitive complexity 35 (threshold 15). Drivers by points: error handling 13 (24 pts), if/else 7 (10 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderBottomConsole (cognitive 35) · ×1
  • ReaderScreenKt.ReaderBottomConsole (cognitive 35) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:734 — ReaderScreenKt.ReaderBottomConsole has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23 (24 pts), boolean chains 9, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ReadiumWebReaderAdapter.execute (cognitive 35) · ×1
  • ReadiumWebReaderAdapter.execute (cognitive 35) apps/web/features/reader/v3/adapters/readium-adapter.ts:549 — ReadiumWebReaderAdapter.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 0019_backfill_scan_gaps.backfill_scan_gaps (cognitive 34) · ×1
  • 0019_backfill_scan_gaps.backfill_scan_gaps (cognitive 34) apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:77 — 0019_backfill_scan_gaps.backfill_scan_gaps has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (24 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 · 0020_recheck_scan_gaps.backfill_scan_gaps (cognitive 34) · ×1
  • 0020_recheck_scan_gaps.backfill_scan_gaps (cognitive 34) apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py:78 — 0020_recheck_scan_gaps.backfill_scan_gaps has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (24 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 · problems.failure_problem (cognitive 34) · ×1
  • problems.failure_problem (cognitive 34) apps/api-python/app/modules/backup/infrastructure/problems.py:23 — problems.failure_problem has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 9 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProcessReadableResourceImportTask.prepare_resource_covers (cognitive 34) · ×1
  • ProcessReadableResourceImportTask.prepare_resource_covers (cognitive 34) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1115 — ProcessReadableResourceImportTask.prepare_resource_covers has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 3 (9 pts), loops 2 (5 pts), boolean chains 2 (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 · legacy_views._resource_view (cognitive 34) · ×1
  • legacy_views._resource_view (cognitive 34) apps/api-python/app/modules/library/infrastructure/legacy_views.py:177 — legacy_views._resource_view has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 29, boolean chains 4, if/else 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 · SqlAlchemyMetadataPatches.apply (cognitive 34) · ×1
  • SqlAlchemyMetadataPatches.apply (cognitive 34) apps/api-python/app/modules/library/infrastructure/metadata_patches.py:290 — SqlAlchemyMetadataPatches.apply has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · source_name._name_parts (cognitive 34) · ×1
  • source_name._name_parts (cognitive 34) apps/api-python/app/modules/metadata/domain/source_name.py:24 — source_name._name_parts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 2 (5 pts), boolean chains 3 (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 · xml_policy._scan_entity_declarations (cognitive 34) · ×1
  • xml_policy._scan_entity_declarations (cognitive 34) REDACTED:299 — xml_policy._scan_entity_declarations has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 3, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · resource_reader._derive_display_percent (cognitive 34) · ×1
  • resource_reader._derive_display_percent (cognitive 34) apps/api-python/app/modules/reader/application/resource_reader.py:465 — resource_reader._derive_display_percent has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetadataLookupWorker._run (cognitive 34) · ×1
  • MetadataLookupWorker._run (cognitive 34) REDACTED:1154 — MetadataLookupWorker._run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 3 (10 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosReaderBootstrapView.body (cognitive 34) · ×1
  • IosReaderBootstrapView.body (cognitive 34) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:908 — IosReaderBootstrapView.body has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (9 pts), match/switch 2 (5 pts), boolean chains 4 (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 · generate-reader-safety-conformance.evaluateFactCase (cognitive 34) · ×1
  • generate-reader-safety-conformance.evaluateFactCase (cognitive 34) REDACTED:563 — generate-reader-safety-conformance.evaluateFactCase has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 17, if/else 8 (15 pts), match/switch 1, ternaries 1 (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · application.prepare_preview (cognitive 33) · ×1
  • application.prepare_preview (cognitive 33) apps/api-python/app/modules/feedback/application.py:45 — application.prepare_preview has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 5 (14 pts), boolean chains 9, if/else 5 (8 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderPreferenceSheet.settingRow (cognitive 33) · ×1
  • ReaderPreferenceSheet.settingRow (cognitive 33) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlSheets.swift:244 — ReaderPreferenceSheet.settingRow has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 12, ternaries 5 (8 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · reader-safety-policy.parseEntityDefinitions (cognitive 33) · ×1
  • reader-safety-policy.parseEntityDefinitions (cognitive 33) apps/web/features/reader/v3/security/reader-safety-policy.ts:174 — reader-safety-policy.parseEntityDefinitions has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reader-shell.ResourceNavigationPanel (cognitive 33) · ×1
  • reader-shell.ResourceNavigationPanel (cognitive 33) apps/web/features/reader/reader-shell.tsx:1383 — reader-shell.ResourceNavigationPanel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 18 (24 pts), boolean chains 9 (nesting depth added 6). Of this number, 17 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · recognition-settings-panel.RecognitionSettingsPanel (cognitive 33) · ×1
  • recognition-settings-panel.RecognitionSettingsPanel (cognitive 33) apps/web/features/organize/recognition-settings-panel.tsx:75 — recognition-settings-panel.RecognitionSettingsPanel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 13 (18 pts), boolean chains 8, if/else 5, error handling 2 (nesting depth added 5). Most of this is not in the body itself: 9 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 86, a function literal at line 145, save, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · strict-fb2-parser.parseStrictFb2 (cognitive 33) · ×1
  • strict-fb2-parser.parseStrictFb2 (cognitive 33) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:248 — strict-fb2-parser.parseStrictFb2 has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · comic_archives.inspect_comic_archive (cognitive 32) · ×1
  • comic_archives.inspect_comic_archive (cognitive 32) REDACTED:498 — comic_archives.inspect_comic_archive has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 11 (12 pts), error handling 2 (4 pts), ternaries 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ReadableResourceWorkerProcessor._finish (cognitive 32) · ×1
  • ReadableResourceWorkerProcessor._finish (cognitive 32) apps/api-python/app/modules/imports/infrastructure/readable_resource/worker.py:152 — ReadableResourceWorkerProcessor._finish has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (26 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemySourceNodeRepository.reconcile_batch (cognitive 32) · ×1
  • SqlAlchemySourceNodeRepository.reconcile_batch (cognitive 32) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:269 — SqlAlchemySourceNodeRepository.reconcile_batch has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6, ternaries 3 (5 pts), loops 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 · StandardMetadataPublication.prepare (cognitive 32) · ×1
  • StandardMetadataPublication.prepare (cognitive 32) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:204 — StandardMetadataPublication.prepare has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 4 (8 pts), boolean chains 6, error handling 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 · epub_adapter._validated_entries (cognitive 32) · ×1
  • epub_adapter._validated_entries (cognitive 32) REDACTED:166 — epub_adapter._validated_entries has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 5, loops 3 (5 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApiClient.loadAuthenticatedAsset (cognitive 32) · ×1
  • ApiClient.loadAuthenticatedAsset (cognitive 32) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:301 — ApiClient.loadAuthenticatedAsset has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 4, match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosReflowableReaderSession.open (cognitive 32) · ×1
  • IosReflowableReaderSession.open (cognitive 32) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:541 — IosReflowableReaderSession.open has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, error handling 3 (nesting depth added 14). 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 · organize-job-detail-page.OrganizeJobDetailPage (cognitive 32) · ×1
  • organize-job-detail-page.OrganizeJobDetailPage (cognitive 32) apps/web/features/organize/organize-job-detail-page.tsx:46 — organize-job-detail-page.OrganizeJobDetailPage has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 18 (26 pts), if/else 4, boolean chains 2 (nesting depth added 8). Of this number, 21 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · epub-archive-safety.preflightEpubArchiveEntries (cognitive 32) · ×1
  • epub-archive-safety.preflightEpubArchiveEntries (cognitive 32) apps/web/features/reader/v3/security/epub-archive-safety.ts:166 — epub-archive-safety.preflightEpubArchiveEntries has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (28 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UpdateUser.execute (cognitive 31) · ×1
  • UpdateUser.execute (cognitive 31) apps/api-python/app/modules/auth/application/user_management.py:236 — UpdateUser.execute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 11, ternaries 4, error handling 1 (3 pts) (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 · ResourcePreviewCache.prune (cognitive 31) · ×1
  • ResourcePreviewCache.prune (cognitive 31) apps/api-python/app/modules/media/infrastructure/resource_preview_cache.py:110 — ResourcePreviewCache.prune has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · file_writeback.cleanup_orphan_prepared_files (cognitive 31) · ×1
  • file_writeback.cleanup_orphan_prepared_files (cognitive 31) apps/api-python/app/modules/metadata/infrastructure/file_writeback.py:45 — file_writeback.cleanup_orphan_prepared_files has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 4 (10 pts), loops 2 (3 pts), boolean chains 2, 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 · pdf_writeback.patch_xmp (cognitive 31) · ×1
  • pdf_writeback.patch_xmp (cognitive 31) apps/api-python/app/modules/metadata/infrastructure/pdf_writeback.py:42 — pdf_writeback.patch_xmp has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (8 pts), ternaries 3 (8 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_metadata._read_with_ffprobe (cognitive 31) · ×1
  • audio_metadata._read_with_ffprobe (cognitive 31) apps/api-python/app/services/audio_metadata.py:249 — audio_metadata._read_with_ffprobe has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 9, ternaries 5 (7 pts), loops 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LibraryStore.refreshAfterManagement (cognitive 31) · ×1
  • LibraryStore.refreshAfterManagement (cognitive 31) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:320 — LibraryStore.refreshAfterManagement has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (7 pts), match/switch 1 (4 pts), error handling 1 (2 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 · api.normalizeAudioBootstrap (cognitive 31) · ×1
  • api.normalizeAudioBootstrap (cognitive 31) apps/web/features/audio/api.ts:103 — api.normalizeAudioBootstrap has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 13, boolean chains 9, if/else 9. Of this number, 29 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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 · ComicSpreadTrackDriver.renderSlot (cognitive 31) · ×1
  • ComicSpreadTrackDriver.renderSlot (cognitive 31) apps/web/features/reader/v3/adapters/comic-track.ts:312 — ComicSpreadTrackDriver.renderSlot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 4 (8 pts), boolean chains 6 (nesting depth added 9). Of this number, 21 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · automation-settings-page.ConfigurationPanel (cognitive 31) · ×1
  • automation-settings-page.ConfigurationPanel (cognitive 31) apps/web/features/automation/ui/automation-settings-page.tsx:87 — automation-settings-page.ConfigurationPanel has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 9 (14 pts), error handling 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 12 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (copy, a function literal at line 96, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · exception_diagnostics.format_exception_diagnostics (cognitive 30) · ×1
  • exception_diagnostics.format_exception_diagnostics (cognitive 30) apps/api-python/app/core/exception_diagnostics.py:343 — exception_diagnostics.format_exception_diagnostics has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (9 pts), ternaries 3, 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 · persistence._converted_column_value (cognitive 30) · ×1
  • persistence._converted_column_value (cognitive 30) apps/api-python/app/modules/backup/infrastructure/persistence.py:203 — persistence._converted_column_value has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), error handling 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApplyMetadataPatches.execute (cognitive 30) · ×1
  • ApplyMetadataPatches.execute (cognitive 30) apps/api-python/app/modules/library/application/metadata_patches.py:100 — ApplyMetadataPatches.execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 3, loops 2, 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 · filter_query._condition (cognitive 30) · ×1
  • filter_query._condition (cognitive 30) apps/api-python/app/modules/library/infrastructure/filter_query.py:262 — filter_query._condition has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (24 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FilesystemLocalMetadataCoverParser.extract_cover (cognitive 30) · ×1
  • FilesystemLocalMetadataCoverParser.extract_cover (cognitive 30) apps/api-python/app/modules/library/infrastructure/local_cover_regeneration.py:77 — FilesystemLocalMetadataCoverParser.extract_cover has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 3 (5 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · html_serialization._plaintext_prefix (cognitive 30) · ×1
  • html_serialization._plaintext_prefix (cognitive 30) apps/api-python/app/modules/publications/infrastructure/html_serialization.py:110 — html_serialization._plaintext_prefix has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (8 pts), ternaries 1 (2 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 · LoginScreenKt.LoginScreen (cognitive 30) · ×1
  • LoginScreenKt.LoginScreen (cognitive 30) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/auth/LoginScreen.kt:74 — LoginScreenKt.LoginScreen has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (21 pts), match/switch 5, boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · FacetViewModel.load (cognitive 30) · ×1
  • FacetViewModel.load (cognitive 30) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:124 — FacetViewModel.load has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 4, error handling 2, match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkDetailScreenKt.WorkContentEntryCard (cognitive 30) · ×1
  • WorkDetailScreenKt.WorkContentEntryCard (cognitive 30) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1531 — WorkDetailScreenKt.WorkContentEntryCard has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (28 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 · IosReaderBootstrapHost.beginDownload (cognitive 30) · ×1
  • IosReaderBootstrapHost.beginDownload (cognitive 30) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderComposition.swift:766 — IosReaderBootstrapHost.beginDownload has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 4 (8 pts), boolean chains 7, 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 · reader-safety-policy.rewriteReferences (cognitive 30) · ×1
  • reader-safety-policy.rewriteReferences (cognitive 30) apps/web/features/reader/v3/security/reader-safety-policy.ts:242 — reader-safety-policy.rewriteReferences has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27 (62 pts), ternaries 7 (26 pts), loops 5 (6 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 2 other methods here (reader-safety-policy.rewriteReferences::appendEscaped, reader-safety-policy.rewriteReferences::expandEntity) 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 · source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog · ×1
  • source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog::apply (cognitive 30) apps/web/features/books/ui/source-node-metadata-dialogs.tsx:152 — source-node-metadata-dialogs.SourceNodeMetadataRecognitionDialog::apply has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 6 (8 pts), boolean chains 4, error handling 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 · PdfReaderAdapter.renderPage (cognitive 30) · ×1
  • PdfReaderAdapter.renderPage (cognitive 30) apps/web/features/reader/v3/adapters/pdf-adapter.ts:692 — PdfReaderAdapter.renderPage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, ternaries 4 (6 pts), error handling 3 (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 · kindle-send-queue-page.KindleSendQueuePage (cognitive 30) · ×1
  • kindle-send-queue-page.KindleSendQueuePage (cognitive 30) apps/web/features/kindle/kindle-send-queue-page.tsx:90 — kindle-send-queue-page.KindleSendQueuePage has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 18 (21 pts), if/else 5, boolean chains 2, error handling 2 (nesting depth added 3). Most of this is not in the body itself: 4 of the 30 points are its own statements and the rest belongs to 4 function items inside it that branch (mutate, a function literal at line 179, a function literal at line 100, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · generate-reader-safety-conformance.archiveIsUnsafe (cognitive 30) · ×1
  • generate-reader-safety-conformance.archiveIsUnsafe (cognitive 30) REDACTED:529 — generate-reader-safety-conformance.archiveIsUnsafe has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exception_diagnostics._exception_facts (cognitive 29) · ×1
  • exception_diagnostics._exception_facts (cognitive 29) apps/api-python/app/core/exception_diagnostics.py:218 — exception_diagnostics._exception_facts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exception_diagnostics.emergency_diagnostic (cognitive 29) · ×1
  • exception_diagnostics.emergency_diagnostic (cognitive 29) apps/api-python/app/core/exception_diagnostics.py:436 — exception_diagnostics.emergency_diagnostic has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 5 (9 pts), error handling 3 (7 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 · reflowable_metadata._inspect_mobi_family (cognitive 29) · ×1
  • reflowable_metadata._inspect_mobi_family (cognitive 29) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:191 — reflowable_metadata._inspect_mobi_family has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 13, if/else 11 (12 pts), ternaries 3, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · file_moves.validate_move_set (cognitive 29) · ×1
  • file_moves.validate_move_set (cognitive 29) apps/api-python/app/modules/library/domain/file_moves.py:108 — file_moves.validate_move_set has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 6 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_structure.mp3_structure (cognitive 29) · ×1
  • audio_structure.mp3_structure (cognitive 29) apps/api-python/app/modules/metadata/infrastructure/audio_structure.py:48 — audio_structure.mp3_structure has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 6, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http._organize_job_view (cognitive 29) · ×1
  • http._organize_job_view (cognitive 29) apps/api-python/app/modules/organize/presentation/http.py:130 — http._organize_job_view has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 20, if/else 7 (8 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · health_runs._run_health_checks (cognitive 29) · ×1
  • health_runs._run_health_checks (cognitive 29) apps/api-python/app/modules/system/infrastructure/health_runs.py:731 — health_runs._run_health_checks has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, loops 3 (5 pts), error handling 2 (3 pts), ternaries 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KindleSendQueueWorker._run (cognitive 29) · ×1
  • KindleSendQueueWorker._run (cognitive 29) apps/api-python/app/services/kindle_queue.py:441 — KindleSendQueueWorker._run has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 3 (8 pts), error handling 2 (4 pts), loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ApiClient.loadAuthenticatedJson (cognitive 29) · ×1
  • ApiClient.loadAuthenticatedJson (cognitive 29) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:405 — ApiClient.loadAuthenticatedJson has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 4, boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanLibrarySourceTree._process_regular_file (cognitive 28) · ×1
  • ScanLibrarySourceTree._process_regular_file (cognitive 28) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1206 — ScanLibrarySourceTree._process_regular_file has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 6, ternaries 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 · PrepareFileMovePlan.execute (cognitive 28) · ×1
  • PrepareFileMovePlan.execute (cognitive 28) apps/api-python/app/modules/library/application/file_move_plans.py:114 — PrepareFileMovePlan.execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · organize_service.run_douban_crawler_provider (cognitive 28) · ×1
  • organize_service.run_douban_crawler_provider (cognitive 28) REDACTED:680 — organize_service.run_douban_crawler_provider has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, ternaries 7 (9 pts), if/else 7 (8 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · installed.wheel_install_paths (cognitive 28) · ×1
  • installed.wheel_install_paths (cognitive 28) apps/api-python/shuku_dependencies/installed.py:108 — installed.wheel_install_paths has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdministrativeSettingsUiKt.failureText (cognitive 28) · ×1
  • AdministrativeSettingsUiKt.failureText (cognitive 28) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:329 — AdministrativeSettingsUiKt.failureText has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (26 pts), match/switch 2 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ManagedDownloadStore.verifiedPageSetBytes (cognitive 28) · ×1
  • ManagedDownloadStore.verifiedPageSetBytes (cognitive 28) apps/mobile/iosApp/ErmaoLibrary/Persistence/ManagedDownloadStore.swift:212 — ManagedDownloadStore.verifiedPageSetBytes has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 21, if/else 3 (5 pts), loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DownloadCenterStore.executeApplicableManagementAction (cognitive 28) · ×1
  • DownloadCenterStore.executeApplicableManagementAction (cognitive 28) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:367 — DownloadCenterStore.executeApplicableManagementAction has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (11 pts), error handling 3, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadCenterStore.removeManagementDownload (cognitive 28) · ×1
  • DownloadCenterStore.removeManagementDownload (cognitive 28) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:481 — DownloadCenterStore.removeManagementDownload has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (11 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WorkDetailView.resourceDetailSection (cognitive 28) · ×1
  • WorkDetailView.resourceDetailSection (cognitive 28) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1386 — WorkDetailView.resourceDetailSection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · library-batch-actions.LibraryBatchDialog · ×1
  • library-batch-actions.LibraryBatchDialog::submit (cognitive 28) apps/web/features/library/library-batch-actions.tsx:315 — library-batch-actions.LibraryBatchDialog::submit has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 8 (21 pts), if/else 4 (6 pts), error handling 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (library-batch-actions.LibraryBatchDialog) 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 · ComicArchive._open (cognitive 27) · ×1
  • ComicArchive._open (cognitive 27) REDACTED:324 — ComicArchive._open has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 6 (11 pts), ternaries 2 (3 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 · AutomationWrites.book_tags (cognitive 27) · ×1
  • AutomationWrites.book_tags (cognitive 27) apps/api-python/app/modules/automation/application/writes.py:337 — AutomationWrites.book_tags has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 4 (5 pts), boolean chains 3, error handling 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · inspection.inspect_backup (cognitive 27) · ×1
  • inspection.inspect_backup (cognitive 27) apps/api-python/app/modules/backup/infrastructure/inspection.py:36 — inspection.inspect_backup has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, ternaries 4, error handling 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ProcessReadableResourceImportTask.finalize_resource (cognitive 27) · ×1
  • ProcessReadableResourceImportTask.finalize_resource (cognitive 27) apps/api-python/app/modules/imports/application/readable_resource/process_import_task.py:1289 — ProcessReadableResourceImportTask.finalize_resource has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyMetadataPatches.snapshot (cognitive 27) · ×1
  • SqlAlchemyMetadataPatches.snapshot (cognitive 27) apps/api-python/app/modules/library/infrastructure/metadata_patches.py:121 — SqlAlchemyMetadataPatches.snapshot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 6 (8 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemySourceNodeMetadata.update_metadata (cognitive 27) · ×1
  • SqlAlchemySourceNodeMetadata.update_metadata (cognitive 27) apps/api-python/app/modules/library/infrastructure/source_node_commands.py:49 — SqlAlchemySourceNodeMetadata.update_metadata has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 4 (7 pts), boolean chains 4 (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 · opf.parse_opf_metadata (cognitive 27) · ×1
  • opf.parse_opf_metadata (cognitive 27) REDACTED:150 — opf.parse_opf_metadata has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 9, ternaries 3, error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ResourceLocatorIndex.validate (cognitive 27) · ×1
  • ResourceLocatorIndex.validate (cognitive 27) apps/api-python/app/modules/reader/infrastructure/resource_locator_index.py:28 — ResourceLocatorIndex.validate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 6 (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 · AdministrativeSettingsViewModel.execute (cognitive 27) · ×1
  • AdministrativeSettingsViewModel.execute (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsViewModel.kt:102 — AdministrativeSettingsViewModel.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 2 (4 pts), error handling 2, 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 · AndroidAudioPlaybackRuntime.launchRemote (cognitive 27) · ×1
  • AndroidAudioPlaybackRuntime.launchRemote (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:323 — AndroidAudioPlaybackRuntime.launchRemote has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 5 (8 pts), boolean chains 5, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkDetailScreenKt.WorkDetailActionRow (cognitive 27) · ×1
  • WorkDetailScreenKt.WorkDetailActionRow (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:715 — WorkDetailScreenKt.WorkDetailActionRow has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 12, if/else 10, match/switch 4 (5 pts) (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadiumComicSession.prepare (cognitive 27) · ×1
  • ReadiumComicSession.prepare (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:160 — ReadiumComicSession.prepare has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, error handling 5, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderActivity.onCreate (cognitive 27) · ×1
  • ReaderActivity.onCreate (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:150 — ReaderActivity.onCreate has cognitive complexity 27 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 11, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderCatalogSetting (cognitive 27) · ×1
  • ReaderScreenKt.ReaderCatalogSetting (cognitive 27) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1441 — ReaderScreenKt.ReaderCatalogSetting has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CentralDirectoryReader.zip64Values (cognitive 27) · ×1
  • CentralDirectoryReader.zip64Values (cognitive 27) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubArchiveSafetyPreflight.swift:609 — CentralDirectoryReader.zip64Values has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (11 pts), boolean chains 3, loops 1 (nesting depth added 14). Of this number, 21 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · persistence.validate_restore_relationships (cognitive 26) · ×1
  • persistence.validate_restore_relationships (cognitive 26) apps/api-python/app/modules/backup/infrastructure/persistence.py:341 — persistence.validate_restore_relationships has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reflowable_metadata._inspect_fb2 (cognitive 26) · ×1
  • reflowable_metadata._inspect_fb2 (cognitive 26) apps/api-python/app/modules/imports/infrastructure/reflowable_metadata.py:97 — reflowable_metadata._inspect_fb2 has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 9, error handling 2, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · writes.import_book_files (cognitive 26) · ×1
  • writes.import_book_files (cognitive 26) apps/api-python/app/modules/imports/presentation/writes.py:114 — writes.import_book_files has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, error handling 3 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StandardMetadataPublication.inspect (cognitive 26) · ×1
  • StandardMetadataPublication.inspect (cognitive 26) apps/api-python/app/modules/metadata/infrastructure/standard_publication.py:119 — StandardMetadataPublication.inspect has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (25 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 · xml_policy._internal_subset (cognitive 26) · ×1
  • xml_policy._internal_subset (cognitive 26) REDACTED:240 — xml_policy._internal_subset has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_metadata._read_with_mutagen (cognitive 26) · ×1
  • audio_metadata._read_with_mutagen (cognitive 26) apps/api-python/app/services/audio_metadata.py:452 — audio_metadata._read_with_mutagen has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 2 (3 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · verify-reader-safety-conformance.validate_report (cognitive 26) · ×1
  • verify-reader-safety-conformance.validate_report (cognitive 26) packages/reader-contracts/verify-reader-safety-conformance.py:400 — verify-reader-safety-conformance.validate_report has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BookContentNavigationKt.BookContentNavigation (cognitive 26) · ×1
  • BookContentNavigationKt.BookContentNavigation (cognitive 26) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/BookContentNavigation.kt:43 — BookContentNavigationKt.BookContentNavigation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · kindle-send-modal.KindleSendModal (cognitive 26) · ×1
  • kindle-send-modal.KindleSendModal (cognitive 26) apps/web/features/books/kindle-send-modal.tsx:24 — kindle-send-modal.KindleSendModal has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (enqueue, a function literal at line 47, a function literal at line 110, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · IndexedDbPublicationStorage.read (cognitive 26) · ×1
  • IndexedDbPublicationStorage.read (cognitive 26) apps/web/features/reader/v3/original-publication/indexeddb-publication-storage.ts:168 — IndexedDbPublicationStorage.read has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 12). None of this is in the body itself: all 26 points belong to one function literal inside it that branches (line 169). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · strict-fb2-parser.parseStrictFb2.closeElement (cognitive 26) · ×1
  • strict-fb2-parser.parseStrictFb2.closeElement (cognitive 26) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:399 — strict-fb2-parser.parseStrictFb2.closeElement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate-reader-api.typeExpression (cognitive 26) · ×1
  • generate-reader-api.typeExpression (cognitive 26) apps/web/scripts/generate-reader-api.mjs:48 — generate-reader-api.typeExpression has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 5). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · http.update_download_task (cognitive 25) · ×1
  • http.update_download_task (cognitive 25) apps/api-python/app/modules/download/presentation/http.py:271 — http.update_download_task has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, ternaries 9, if/else 6. 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 · metadata_patch.validate_value (cognitive 25) · ×1
  • metadata_patch.validate_value (cognitive 25) apps/api-python/app/modules/library/domain/metadata_patch.py:68 — metadata_patch.validate_value has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4, error handling 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 · http_streaming._send_zip_entry (cognitive 25) · ×1
  • http_streaming._send_zip_entry (cognitive 25) apps/api-python/app/modules/media/infrastructure/http_streaming.py:975 — http_streaming._send_zip_entry has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, error handling 2, 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 · http.create_shelf (cognitive 25) · ×1
  • http.create_shelf (cognitive 25) apps/api-python/app/modules/shelf/presentation/http.py:609 — http.create_shelf has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, error handling 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderNumberSetting (cognitive 25) · ×1
  • ReaderScreenKt.ReaderNumberSetting (cognitive 25) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1794 — ReaderScreenKt.ReaderNumberSetting has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosAudioResourceLoader.serve (cognitive 25) · ×1
  • IosAudioResourceLoader.serve (cognitive 25) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioResourceLoader.swift:67 — IosAudioResourceLoader.serve has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 2, error handling 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadCenterStore.executeManagement (cognitive 25) · ×1
  • DownloadCenterStore.executeManagement (cognitive 25) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:138 — DownloadCenterStore.executeManagement has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (10 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosPdfiumNavigatorViewController.startRender (cognitive 25) · ×1
  • IosPdfiumNavigatorViewController.startRender (cognitive 25) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumNavigator.swift:149 — IosPdfiumNavigatorViewController.startRender has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 10, error handling 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NativeBookManagementStore.run (cognitive 25) · ×1
  • NativeBookManagementStore.run (cognitive 25) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:219 — NativeBookManagementStore.run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (6 pts), loops 1 (3 pts), boolean chains 2, ternaries 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 · upload-book-dialog.UploadBookDialog (cognitive 25) · ×1
  • upload-book-dialog.UploadBookDialog (cognitive 25) apps/web/features/library/upload-book-dialog.tsx:26 — upload-book-dialog.UploadBookDialog has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 7, boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (saveFiles, a function literal at line 37, a function literal at line 35, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · use-update-operations.useUpdateOperations (cognitive 25) · ×1
  • use-update-operations.useUpdateOperations (cognitive 25) apps/web/features/updates/application/use-update-operations.ts:9 — use-update-operations.useUpdateOperations has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 8, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 38, 33, 24, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · opds-settings-page.OpdsSettingsPage (cognitive 25) · ×1
  • opds-settings-page.OpdsSettingsPage (cognitive 25) apps/web/features/settings/center/opds-settings-page.tsx:12 — opds-settings-page.OpdsSettingsPage has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (13 pts), if/else 5, boolean chains 4, error handling 3 (nesting depth added 4). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (toggleEnabled, savePublicBaseUrl, a function literal at line 28, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · session.readerSessionReducer (cognitive 25) · ×1
  • session.readerSessionReducer (cognitive 25) packages/reader-core/src/session.ts:96 — session.readerSessionReducer has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 3 (5 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBackupRestoreWriter.apply (cognitive 24) · ×1
  • SqlAlchemyBackupRestoreWriter.apply (cognitive 24) apps/api-python/app/modules/backup/infrastructure/persistence.py:465 — SqlAlchemyBackupRestoreWriter.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata_patch.prepare_metadata_patch (cognitive 24) · ×1
  • metadata_patch.prepare_metadata_patch (cognitive 24) apps/api-python/app/modules/library/domain/metadata_patch.py:133 — metadata_patch.prepare_metadata_patch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, ternaries 1 (3 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 · book_list._project_books (cognitive 24) · ×1
  • book_list._project_books (cognitive 24) apps/api-python/app/modules/library/infrastructure/book_list.py:318 — book_list._project_books has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBulkBookOperations._find_replacements (cognitive 24) · ×1
  • SqlAlchemyBulkBookOperations._find_replacements (cognitive 24) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:458 — SqlAlchemyBulkBookOperations._find_replacements has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyFileMoveIndex.apply (cognitive 24) · ×1
  • SqlAlchemyFileMoveIndex.apply (cognitive 24) apps/api-python/app/modules/library/infrastructure/file_move_index.py:73 — SqlAlchemyFileMoveIndex.apply has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 2 (5 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 · kindle_queue._send_task (cognitive 24) · ×1
  • kindle_queue._send_task (cognitive 24) apps/api-python/app/services/kindle_queue.py:181 — kindle_queue._send_task has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 8, error handling 2 (3 pts), ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AudioPlayerUiKt.AudioNowPlayingScreen (cognitive 24) · ×1
  • AudioPlayerUiKt.AudioNowPlayingScreen (cognitive 24) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:229 — AudioPlayerUiKt.AudioNowPlayingScreen has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · WorkDetailViewModel.load (cognitive 24) · ×1
  • WorkDetailViewModel.load (cognitive 24) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:506 — WorkDetailViewModel.load has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, error handling 2, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManagementTagEditorKt.ManagementTagEditor (cognitive 24) · ×1
  • ManagementTagEditorKt.ManagementTagEditor (cognitive 24) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/workmanagement/ManagementTagEditor.kt:56 — ManagementTagEditorKt.ManagementTagEditor has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ReaderPositionSyncCoordinator.drain (cognitive 24) · ×1
  • ReaderPositionSyncCoordinator.drain (cognitive 24) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/application/ReaderPositionSyncCoordinator.kt:115 — ReaderPositionSyncCoordinator.drain has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 2 (4 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · multi-value-combobox.MultiValueCombobox · ×1
  • multi-value-combobox.MultiValueCombobox::onInputKeyDown (cognitive 24) apps/web/components/ui/multi-value-combobox.tsx:208 — multi-value-combobox.MultiValueCombobox::onInputKeyDown has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (multi-value-combobox.MultiValueCombobox) 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 · book-metadata-editor.BookMetadataEditor (cognitive 24) · ×1
  • book-metadata-editor.BookMetadataEditor (cognitive 24) apps/web/features/books/ui/book-metadata-editor.tsx:43 — book-metadata-editor.BookMetadataEditor has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 8, boolean chains 4, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 5 function items inside it that branch (save, a function literal at line 117, a function literal at line 149, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · pwa-client.PwaDebugPanel (cognitive 24) · ×1
  • pwa-client.PwaDebugPanel (cognitive 24) apps/web/components/system/pwa-client.tsx:457 — pwa-client.PwaDebugPanel has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (18 pts), if/else 5, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 620, 481, 495, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ComicContinuousController.renderSlot (cognitive 24) · ×1
  • ComicContinuousController.renderSlot (cognitive 24) apps/web/features/reader/v3/adapters/comic-continuous.ts:150 — ComicContinuousController.renderSlot has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 10). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · book-card.BookCard (cognitive 24) · ×1
  • book-card.BookCard (cognitive 24) apps/web/components/book/book-card.tsx:18 — book-card.BookCard has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 15 (19 pts), boolean chains 4, if/else 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, 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 · users._validate_preference (cognitive 23) · ×1
  • users._validate_preference (cognitive 23) apps/api-python/app/modules/auth/presentation/users.py:131 — users._validate_preference has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · persistence.prepare_table_records (cognitive 23) · ×1
  • persistence.prepare_table_records (cognitive 23) apps/api-python/app/modules/backup/infrastructure/persistence.py:266 — persistence.prepare_table_records has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http.update_library (cognitive 23) · ×1
  • http.update_library (cognitive 23) apps/api-python/app/modules/imports/presentation/http.py:367 — http.update_library has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, error handling 2 (4 pts) (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 · SqlAlchemyBulkBookOperations.apply_find_replace (cognitive 23) · ×1
  • SqlAlchemyBulkBookOperations.apply_find_replace (cognitive 23) apps/api-python/app/modules/library/infrastructure/bulk_operations.py:572 — SqlAlchemyBulkBookOperations.apply_find_replace has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 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 · install_plan.validate_prepared (cognitive 23) · ×1
  • install_plan.validate_prepared (cognitive 23) apps/api-python/app/modules/updates/infrastructure/install_plan.py:34 — install_plan.validate_prepared has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata_file_writeback.process_next_metadata_writeback (cognitive 23) · ×1
  • metadata_file_writeback.process_next_metadata_writeback (cognitive 23) apps/api-python/app/services/metadata_file_writeback.py:295 — metadata_file_writeback.process_next_metadata_writeback has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, ternaries 1 (2 pts), 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 · AudioPlayerUiKt.AudioChapterSheet (cognitive 23) · ×1
  • AudioPlayerUiKt.AudioChapterSheet (cognitive 23) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1060 — AudioPlayerUiKt.AudioChapterSheet has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (23 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 · DownloadResourceRuntime.ensure (cognitive 23) · ×1
  • DownloadResourceRuntime.ensure (cognitive 23) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/application/DownloadResourceRuntime.kt:124 — DownloadResourceRuntime.ensure has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, loops 2, match/switch 2, error handling 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 · FacetStore.refreshAfterManagement (cognitive 23) · ×1
  • FacetStore.refreshAfterManagement (cognitive 23) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:650 — FacetStore.refreshAfterManagement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), ternaries 1 (3 pts), error handling 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 · WorkDescriptionPlainText.textOutsideMarkup (cognitive 23) · ×1
  • WorkDescriptionPlainText.textOutsideMarkup (cognitive 23) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:53 — WorkDescriptionPlainText.textOutsideMarkup has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosReadiumRuntime.swift.protectEpubAsset (cognitive 23) · ×1
  • IosReadiumRuntime.swift.protectEpubAsset (cognitive 23) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:260 — IosReadiumRuntime.swift.protectEpubAsset has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 5 (7 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata-lookup-modal.MetadataLookupModal (cognitive 23) · ×1
  • metadata-lookup-modal.MetadataLookupModal (cognitive 23) apps/web/features/books/metadata-lookup-modal.tsx:92 — metadata-lookup-modal.MetadataLookupModal has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 36 (47 pts), if/else 36 (40 pts), boolean chains 18, error handling 3 (nesting depth added 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (metadata-lookup-modal.MetadataLookupModal::applySelected) 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 · readium-navigation.readiumTotalProgression (cognitive 23) · ×1
  • readium-navigation.readiumTotalProgression (cognitive 23) apps/web/features/reader/v3/adapters/readium-navigation.ts:184 — readium-navigation.readiumTotalProgression has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, 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 · use-reader-session.useReaderSession (cognitive 23) · ×1
  • use-reader-session.useReaderSession (cognitive 23) apps/web/features/reader/v3/use-reader-session.ts:150 — use-reader-session.useReaderSession has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 2). None of this is in the body itself: all 23 points belong to 6 function literals inside it that branch (lines 226, 286, 217, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · pdf_embedded_metadata._values (cognitive 22) · ×1
  • pdf_embedded_metadata._values (cognitive 22) apps/api-python/app/infrastructure/pdf_embedded_metadata.py:101 — pdf_embedded_metadata._values has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutomationUploads.begin_upload (cognitive 22) · ×1
  • AutomationUploads.begin_upload (cognitive 22) apps/api-python/app/modules/automation/application/uploads.py:182 — AutomationUploads.begin_upload has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, error handling 3 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · writeback_plans._destination (cognitive 22) · ×1
  • writeback_plans._destination (cognitive 22) apps/api-python/app/modules/automation/application/writeback_plans.py:66 — writeback_plans._destination has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, ternaries 2 (5 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 · UpdateSourceNodePresentation.execute (cognitive 22) · ×1
  • UpdateSourceNodePresentation.execute (cognitive 22) apps/api-python/app/modules/library/application/source_node_commands.py:158 — UpdateSourceNodePresentation.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, ternaries 3, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · pdf_writeback.write_pdf_metadata (cognitive 22) · ×1
  • pdf_writeback.write_pdf_metadata (cognitive 22) apps/api-python/app/modules/metadata/infrastructure/pdf_writeback.py:152 — pdf_writeback.write_pdf_metadata has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, ternaries 1 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · commands.prepare_organize_policy_update (cognitive 22) · ×1
  • commands.prepare_organize_policy_update (cognitive 22) apps/api-python/app/modules/organize/application/commands.py:49 — commands.prepare_organize_policy_update has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, error handling 3 (5 pts), ternaries 2 (3 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 · events.list_system_events_page (cognitive 22) · ×1
  • events.list_system_events_page (cognitive 22) apps/api-python/app/modules/system/infrastructure/events.py:168 — events.list_system_events_page has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, 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 · DownloadManagementPolicy.project (cognitive 22) · ×1
  • DownloadManagementPolicy.project (cognitive 22) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/domain/DownloadManagement.kt:48 — DownloadManagementPolicy.project has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 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 · ServerBaseUrl.normalizeAuthority (cognitive 22) · ×1
  • ServerBaseUrl.normalizeAuthority (cognitive 22) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/servers/domain/ServerBaseUrl.kt:68 — ServerBaseUrl.normalizeAuthority has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadCenterStore.awaitVerifiedReaderDownloadOperation (cognitive 22) · ×1
  • DownloadCenterStore.awaitVerifiedReaderDownloadOperation (cognitive 22) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterStore.swift:287 — DownloadCenterStore.awaitVerifiedReaderDownloadOperation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MultiDownloadSheet.perform (cognitive 22) · ×1
  • MultiDownloadSheet.perform (cognitive 22) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:821 — MultiDownloadSheet.perform has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 7 (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 · reader-safety-policy.sanitizeAuthoredCss (cognitive 22) · ×1
  • reader-safety-policy.sanitizeAuthoredCss (cognitive 22) apps/web/features/reader/v3/security/reader-safety-policy.ts:630 — reader-safety-policy.sanitizeAuthoredCss has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (8 pts), loops 3, 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 · automation-settings-page.GrantForm (cognitive 22) · ×1
  • automation-settings-page.GrantForm (cognitive 22) apps/web/features/automation/ui/automation-settings-page.tsx:52 — automation-settings-page.GrantForm has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 13 (16 pts), boolean chains 3, if/else 3 (nesting depth added 3). Of this number, 11 points are the body's own statements and 11 belong to 4 function items inside it that branch. 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 · identity_policy.parse_bracketed_series_identity (cognitive 21) · ×1
  • identity_policy.parse_bracketed_series_identity (cognitive 21) apps/api-python/app/modules/imports/application/identity_policy.py:191 — identity_policy.parse_bracketed_series_identity has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OsSourceTreeFilesystem.metadata_input_observations (cognitive 21) · ×1
  • OsSourceTreeFilesystem.metadata_input_observations (cognitive 21) apps/api-python/app/modules/imports/infrastructure/readable_resource/filesystem.py:41 — OsSourceTreeFilesystem.metadata_input_observations has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 3 (6 pts), error handling 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 · SqlAlchemyMoveTopology.destination (cognitive 21) · ×1
  • SqlAlchemyMoveTopology.destination (cognitive 21) apps/api-python/app/modules/library/infrastructure/move_topology.py:153 — SqlAlchemyMoveTopology.destination has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBookResourceRepository.apply_local_metadata (cognitive 21) · ×1
  • SqlAlchemyBookResourceRepository.apply_local_metadata (cognitive 21) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1016 — SqlAlchemyBookResourceRepository.apply_local_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, ternaries 2 (4 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SqlAlchemyRecognizedMetadata.apply_changes (cognitive 21) · ×1
  • SqlAlchemyRecognizedMetadata.apply_changes (cognitive 21) apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:161 — SqlAlchemyRecognizedMetadata.apply_changes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (4 pts), boolean chains 3, loops 2 (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 · archive_writeback.preview_archive_metadata (cognitive 21) · ×1
  • archive_writeback.preview_archive_metadata (cognitive 21) apps/api-python/app/modules/metadata/infrastructure/archive_writeback.py:88 — archive_writeback.preview_archive_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 1 (2 pts), ternaries 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 · archive_writeback.write_archive_metadata (cognitive 21) · ×1
  • archive_writeback.write_archive_metadata (cognitive 21) apps/api-python/app/modules/metadata/infrastructure/archive_writeback.py:131 — archive_writeback.write_archive_metadata has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (6 pts), 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 · locator_dom._css_has_active_reference (cognitive 21) · ×1
  • locator_dom._css_has_active_reference (cognitive 21) REDACTED:307 — locator_dom._css_has_active_reference has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mobi_adapter._snapshot (cognitive 21) · ×1
  • mobi_adapter._snapshot (cognitive 21) apps/api-python/app/modules/publications/infrastructure/mobi_adapter.py:432 — mobi_adapter._snapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (7 pts), boolean chains 2, loops 2, 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 · PublicationSnapshotCache.lease (cognitive 21) · ×1
  • PublicationSnapshotCache.lease (cognitive 21) apps/api-python/app/modules/publications/infrastructure/snapshot_cache.py:61 — PublicationSnapshotCache.lease has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dependency_preparation.check_wheel_platform (cognitive 21) · ×1
  • dependency_preparation.check_wheel_platform (cognitive 21) apps/api-python/app/modules/updates/infrastructure/dependency_preparation.py:64 — dependency_preparation.check_wheel_platform has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadResourceRowKt.DownloadResourceRow (cognitive 21) · ×1
  • DownloadResourceRowKt.DownloadResourceRow (cognitive 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/downloads/DownloadResourceRow.kt:49 — DownloadResourceRowKt.DownloadResourceRow has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, boolean chains 8, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LibraryViewModel.loadScope (cognitive 21) · ×1
  • LibraryViewModel.loadScope (cognitive 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/LibraryViewModel.kt:234 — LibraryViewModel.loadScope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3, error handling 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AndroidAvatarSanitizer.sanitize (cognitive 21) · ×1
  • AndroidAvatarSanitizer.sanitize (cognitive 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/me/platform/AndroidMePlatform.kt:51 — AndroidAvatarSanitizer.sanitize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 3 (4 pts), error handling 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 · ReaderScreenKt.ReaderSlider (cognitive 21) · ×1
  • ReaderScreenKt.ReaderSlider (cognitive 21) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:966 — ReaderScreenKt.ReaderSlider has cognitive complexity 21 (threshold 15). Drivers by points: if/else 19 (21 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 · LoadBookContentKt.loadBookContent (cognitive 21) · ×1
  • LoadBookContentKt.loadBookContent (cognitive 21) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/application/LoadBookContent.kt:24 — LoadBookContentKt.loadBookContent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 3 (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 · XmlControlPreprocessor.declarationEnd (cognitive 21) · ×1
  • XmlControlPreprocessor.declarationEnd (cognitive 21) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:871 — XmlControlPreprocessor.declarationEnd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KtorWorkManagementRepository.loadManagementSnapshot (cognitive 21) · ×1
  • KtorWorkManagementRepository.loadManagementSnapshot (cognitive 21) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/infrastructure/KtorWorkManagementRepository.kt:80 — KtorWorkManagementRepository.loadManagementSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManagedDownloadRecord.verifiedSharedArtifact (cognitive 21) · ×1
  • ManagedDownloadRecord.verifiedSharedArtifact (cognitive 21) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadModels.swift:94 — ManagedDownloadRecord.verifiedSharedArtifact has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 18, if/else 2, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · IosFb2PublicationFactory.read (cognitive 21) · ×1
  • IosFb2PublicationFactory.read (cognitive 21) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosFb2PublicationFactory.swift:52 — IosFb2PublicationFactory.read has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (2 pts), error handling 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 · IosReadiumRuntime.open (cognitive 21) · ×1
  • IosReadiumRuntime.open (cognitive 21) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:52 — IosReadiumRuntime.open has cognitive complexity 21 (threshold 15). Drivers by points: error handling 8 (16 pts), ternaries 1 (3 pts), if/else 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ShelfCatalogStore.refresh (cognitive 21) · ×1
  • ShelfCatalogStore.refresh (cognitive 21) apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/ShelfCatalogStore.swift:48 — ShelfCatalogStore.refresh has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 1 (3 pts), error handling 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 · BrowserPublicationStore.download (cognitive 21) · ×1
  • BrowserPublicationStore.download (cognitive 21) apps/web/features/reader/v3/original-publication/browser-publication-store.ts:56 — BrowserPublicationStore.download has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · readium-publication.resolveArchivePath (cognitive 21) · ×1
  • readium-publication.resolveArchivePath (cognitive 21) apps/web/features/reader/v3/adapters/readium-publication.ts:248 — readium-publication.resolveArchivePath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bounded-response.readBoundedResponse (cognitive 21) · ×1
  • bounded-response.readBoundedResponse (cognitive 21) apps/web/shared/api/bounded-response.ts:9 — bounded-response.readBoundedResponse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 2, error handling 1, ternaries 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 · reader-v3-page.OpeningCover (cognitive 21) · ×1
  • reader-v3-page.OpeningCover (cognitive 21) apps/web/features/reader/v3/reader-v3-page.tsx:109 — reader-v3-page.OpeningCover has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11 (16 pts), if/else 3, boolean chains 2 (nesting depth added 5). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · server-exceptions.writeServerLog (cognitive 21) · ×1
  • server-exceptions.writeServerLog (cognitive 21) apps/web/lib/server-exceptions.ts:15 — server-exceptions.writeServerLog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, error handling 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · presentation.submit_feedback (cognitive 20) · ×1
  • presentation.submit_feedback (cognitive 20) apps/api-python/app/modules/feedback/presentation.py:102 — presentation.submit_feedback has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, error handling 2, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BookWork.__post_init__ (cognitive 20) · ×1
  • BookWork.__post_init__ (cognitive 20) apps/api-python/app/modules/imports/application/readable_resource/book_work.py:25 — BookWork.__post_init__ has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ScanLibrarySourceTree._confirmed_missing_parent (cognitive 20) · ×1
  • ScanLibrarySourceTree._confirmed_missing_parent (cognitive 20) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:537 — ScanLibrarySourceTree._confirmed_missing_parent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (4 pts), loops 2 (3 pts), ternaries 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 · ImportAttachmentUploads.target (cognitive 20) · ×1
  • ImportAttachmentUploads.target (cognitive 20) apps/api-python/app/modules/imports/infrastructure/automation_uploads.py:61 — ImportAttachmentUploads.target has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyLibraryImportTaskQueue.continue_book_task (cognitive 20) · ×1
  • SqlAlchemyLibraryImportTaskQueue.continue_book_task (cognitive 20) apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:479 — SqlAlchemyLibraryImportTaskQueue.continue_book_task has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, 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 · ExecuteStandardWrite.execute (cognitive 20) · ×1
  • ExecuteStandardWrite.execute (cognitive 20) apps/api-python/app/modules/metadata/application/execute_standard_writeback.py:87 — ExecuteStandardWrite.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · id3_writeback.write_selected_id3 (cognitive 20) · ×1
  • id3_writeback.write_selected_id3 (cognitive 20) apps/api-python/app/modules/metadata/infrastructure/id3_writeback.py:13 — id3_writeback.write_selected_id3 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (5 pts), error handling 1 (4 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · smart_rules.normalize_smart_shelf_rules (cognitive 20) · ×1
  • smart_rules.normalize_smart_shelf_rules (cognitive 20) apps/api-python/app/modules/shelf/application/smart_rules.py:7 — smart_rules.normalize_smart_shelf_rules has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · OfficialReleases.releases (cognitive 20) · ×1
  • OfficialReleases.releases (cognitive 20) apps/api-python/app/modules/updates/infrastructure/official_source.py:109 — OfficialReleases.releases has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metadata_provider_registry.prepare_metadata_provider_update (cognitive 20) · ×1
  • metadata_provider_registry.prepare_metadata_provider_update (cognitive 20) REDACTED:401 — metadata_provider_registry.prepare_metadata_provider_update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate-reader-http-errors.render_contract (cognitive 20) · ×1
  • generate-reader-http-errors.render_contract (cognitive 20) packages/reader-contracts/generate-reader-http-errors.py:11 — generate-reader-http-errors.render_contract has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkDetailViewModel.loadMultiDownloadResources (cognitive 20) · ×1
  • WorkDetailViewModel.loadMultiDownloadResources (cognitive 20) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/DetailViewModels.kt:612 — WorkDetailViewModel.loadMultiDownloadResources has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2, match/switch 1 (2 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 · IosMobiPublicationPath.resourcePath (cognitive 20) · ×1
  • IosMobiPublicationPath.resourcePath (cognitive 20) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiLazyContainer.swift:18 — IosMobiPublicationPath.resourcePath has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WorkDetailView.contentBrowserSection (cognitive 20) · ×1
  • WorkDetailView.contentBrowserSection (cognitive 20) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:990 — WorkDetailView.contentBrowserSection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · provider.I18nProvider (cognitive 20) · ×1
  • provider.I18nProvider (cognitive 20) apps/web/i18n/provider.tsx:120 — provider.I18nProvider has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 5). None of this is in the body itself: all 20 points belong to 4 function literals inside it that branch (lines 170, 145, 158, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · strict-fb2-parser.parseStartTag (cognitive 20) · ×1
  • strict-fb2-parser.parseStartTag (cognitive 20) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:137 — strict-fb2-parser.parseStartTag has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · server-exceptions.formatServerException (cognitive 20) · ×1
  • server-exceptions.formatServerException (cognitive 20) apps/web/lib/server-exceptions.ts:52 — server-exceptions.formatServerException has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), ternaries 1 (3 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 · TypedContractRoute.__init__ (cognitive 19) · ×1
  • TypedContractRoute.__init__ (cognitive 19) apps/api-python/app/api/typed_route.py:28 — TypedContractRoute.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (6 pts), boolean chains 3, ternaries 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 · exception_diagnostics._exception_chain (cognitive 19) · ×1
  • exception_diagnostics._exception_chain (cognitive 19) apps/api-python/app/core/exception_diagnostics.py:301 — exception_diagnostics._exception_chain has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 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 · AutomationOperations.progress (cognitive 19) · ×1
  • AutomationOperations.progress (cognitive 19) apps/api-python/app/modules/automation/application/operations.py:26 — AutomationOperations.progress has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AutomationOperations.cancel) 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 · AutomationOperations.cancel (cognitive 19) · ×1
  • AutomationOperations.cancel (cognitive 19) apps/api-python/app/modules/automation/application/operations.py:59 — AutomationOperations.cancel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (AutomationOperations.progress) 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 · refresh.project_file_metadata (cognitive 19) · ×1
  • refresh.project_file_metadata (cognitive 19) apps/api-python/app/modules/automation/application/refresh.py:27 — refresh.project_file_metadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (5 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutomationUploads.cleanup (cognitive 19) · ×1
  • AutomationUploads.cleanup (cognitive 19) apps/api-python/app/modules/automation/application/uploads.py:501 — AutomationUploads.cleanup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BuildStandardWritePlan.execute (cognitive 19) · ×1
  • BuildStandardWritePlan.execute (cognitive 19) apps/api-python/app/modules/automation/application/writeback_plans.py:175 — BuildStandardWritePlan.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (4 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 · writeback_plans._values (cognitive 19) · ×1
  • writeback_plans._values (cognitive 19) apps/api-python/app/modules/automation/application/writeback_plans.py:98 — writeback_plans._values has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 1 (3 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 · SqlAlchemyCatalogQueries._resource (cognitive 19) · ×1
  • SqlAlchemyCatalogQueries._resource (cognitive 19) apps/api-python/app/modules/library/infrastructure/catalog.py:238 — SqlAlchemyCatalogQueries._resource has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (12 pts), boolean chains 5, if/else 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · move_inventory.inspect_move_destination (cognitive 19) · ×1
  • move_inventory.inspect_move_destination (cognitive 19) apps/api-python/app/modules/library/infrastructure/move_inventory.py:91 — move_inventory.inspect_move_destination has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2, 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 · ResourceReaderV5Service.save_progress (cognitive 19) · ×1
  • ResourceReaderV5Service.save_progress (cognitive 19) apps/api-python/app/modules/reader/application/resource_reader_v5.py:185 — ResourceReaderV5Service.save_progress has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_metadata.parse_audio_metadata (cognitive 19) · ×1
  • audio_metadata.parse_audio_metadata (cognitive 19) apps/api-python/app/services/audio_metadata.py:178 — audio_metadata.parse_audio_metadata has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (4 pts), error handling 2 (3 pts), ternaries 3, loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audio_metadata._normalized_mutagen_tags (cognitive 19) · ×1
  • audio_metadata._normalized_mutagen_tags (cognitive 19) apps/api-python/app/services/audio_metadata.py:593 — audio_metadata._normalized_mutagen_tags has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, error handling 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 · organize_service.douban_candidates (cognitive 19) · ×1
  • organize_service.douban_candidates (cognitive 19) REDACTED:268 — organize_service.douban_candidates has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 5, if/else 2 (3 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ApiClient.loadAuthenticatedBinary (cognitive 19) · ×1
  • ApiClient.loadAuthenticatedBinary (cognitive 19) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:495 — ApiClient.loadAuthenticatedBinary has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 7, error handling 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 · BookManagementSession.applyRecognition (cognitive 19) · ×1
  • BookManagementSession.applyRecognition (cognitive 19) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/application/BookManagementSession.kt:300 — BookManagementSession.applyRecognition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VisualTokenGenerator.renderCss (cognitive 19) · ×1
  • VisualTokenGenerator.renderCss (cognitive 19) apps/mobile/buildSrc/src/main/java/com/ermao/buildlogic/VisualTokenGenerator.java:278 — VisualTokenGenerator.renderCss has cognitive complexity 19 (threshold 15). Drivers by points: loops 7 (10 pts), ternaries 2 (6 pts), if/else 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · UserEditorView.body (cognitive 19) · ×1
  • UserEditorView.body (cognitive 19) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/UserSettingsViews.swift:140 — UserEditorView.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · IosComicReaderSession.open (cognitive 19) · ×1
  • IosComicReaderSession.open (cognitive 19) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:91 — IosComicReaderSession.open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 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 · IosManagedPublicationStore.resolve (cognitive 19) · ×1
  • IosManagedPublicationStore.resolve (cognitive 19) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosManagedPublicationStore.swift:238 — IosManagedPublicationStore.resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8 (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 · MainTabView.managedTabs (cognitive 19) · ×1
  • MainTabView.managedTabs (cognitive 19) apps/mobile/iosApp/ErmaoLibrary/Features/Shell/MainTabView.swift:171 — MainTabView.managedTabs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 1 (4 pts), loops 1 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkDetailView.observedScreen (cognitive 19) · ×1
  • WorkDetailView.observedScreen (cognitive 19) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:369 — WorkDetailView.observedScreen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, error handling 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · multi-value-combobox.MultiValueCombobox (cognitive 19) · ×1
  • multi-value-combobox.MultiValueCombobox (cognitive 19) apps/web/components/ui/multi-value-combobox.tsx:71 — multi-value-combobox.MultiValueCombobox has cognitive complexity 19 (threshold 15). Drivers by points: if/else 30 (37 pts), ternaries 15 (25 pts), boolean chains 16 (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. This shape REPEATS in the file: one other method here (multi-value-combobox.MultiValueCombobox::onInputKeyDown) 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 · book-shelf-dialog.BookShelfDialog (cognitive 19) · ×1
  • book-shelf-dialog.BookShelfDialog (cognitive 19) apps/web/features/books/ui/book-shelf-dialog.tsx:11 — book-shelf-dialog.BookShelfDialog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (7 pts), boolean chains 2, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (save, a function literal at line 33, a function literal at line 42, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · password-reset-pages.ResetPasswordPage (cognitive 19) · ×1
  • password-reset-pages.ResetPasswordPage (cognitive 19) apps/web/features/settings/password-reset-pages.tsx:82 — password-reset-pages.ResetPasswordPage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 5, boolean chains 2, error handling 2 (nesting depth added 3). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (submit, a function literal at line 91). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · reader-shell.ReaderPreferencesPanel · ×1
  • reader-shell.ReaderPreferencesPanel::control (cognitive 19) apps/web/features/reader/reader-shell.tsx:1500 — reader-shell.ReaderPreferencesPanel::control has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 3 (5 pts) (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 · directory-path-picker.DirectoryNodeRow (cognitive 19) · ×1
  • directory-path-picker.DirectoryNodeRow (cognitive 19) apps/web/features/settings/ui/directory-path-picker.tsx:311 — directory-path-picker.DirectoryNodeRow has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · generate-reader-safety-conformance.evaluateMarkupCase (cognitive 19) · ×1
  • generate-reader-safety-conformance.evaluateMarkupCase (cognitive 19) REDACTED:477 — generate-reader-safety-conformance.evaluateMarkupCase has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prototype.feedbackModal (cognitive 19) · ×1
  • prototype.feedbackModal (cognitive 19) prototypes/feedback-web/prototype.js:236 — prototype.feedbackModal has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10 (19 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 · ImportAttachmentUploads.progress (cognitive 18) · ×1
  • ImportAttachmentUploads.progress (cognitive 18) apps/api-python/app/modules/imports/infrastructure/automation_uploads.py:212 — ImportAttachmentUploads.progress has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 4 (5 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.
D2 · Cognitive Complexity · books._book_record (cognitive 18) · ×1
  • books._book_record (cognitive 18) apps/api-python/app/modules/library/infrastructure/books.py:230 — books._book_record has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 14, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · local_metadata._parse_local_metadata (cognitive 18) · ×1
  • local_metadata._parse_local_metadata (cognitive 18) apps/api-python/app/modules/metadata/application/local_metadata.py:166 — local_metadata._parse_local_metadata has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 6, boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · local_metadata.resolve_local_metadata (cognitive 18) · ×1
  • local_metadata.resolve_local_metadata (cognitive 18) apps/api-python/app/modules/metadata/application/local_metadata.py:242 — local_metadata.resolve_local_metadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · identity_context.identity_clues (cognitive 18) · ×1
  • identity_context.identity_clues (cognitive 18) apps/api-python/app/modules/metadata/infrastructure/identity_context.py:18 — identity_context.identity_clues has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (6 pts), if/else 3 (5 pts), boolean chains 4, loops 2 (3 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 · audio_metadata._repair_misdecoded_text (cognitive 18) · ×1
  • audio_metadata._repair_misdecoded_text (cognitive 18) apps/api-python/app/services/audio_metadata.py:667 — audio_metadata._repair_misdecoded_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · organize_service.first_string (cognitive 18) · ×1
  • organize_service.first_string (cognitive 18) REDACTED:64 — organize_service.first_string has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · organize_service.metadata_search_candidates (cognitive 18) · ×1
  • organize_service.metadata_search_candidates (cognitive 18) REDACTED:1144 — organize_service.metadata_search_candidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AdministrativeCoreScreensKt.EmailKindleSettingsScreen (cognitive 18) · ×1
  • AdministrativeCoreScreensKt.EmailKindleSettingsScreen (cognitive 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt:158 — AdministrativeCoreScreensKt.EmailKindleSettingsScreen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AndroidAudioPlaybackRuntime.launchLocal (cognitive 18) · ×1
  • AndroidAudioPlaybackRuntime.launchLocal (cognitive 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:197 — AndroidAudioPlaybackRuntime.launchLocal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AudioPlayerUiKt.AudioQueueSheet (cognitive 18) · ×1
  • AudioPlayerUiKt.AudioQueueSheet (cognitive 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:929 — AudioPlayerUiKt.AudioQueueSheet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ReaderScreenKt.ReaderPreferencePanel (cognitive 18) · ×1
  • ReaderScreenKt.ReaderPreferencePanel (cognitive 18) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1197 — ReaderScreenKt.ReaderPreferencePanel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · KtorDownloadsGateway.transferAsset (cognitive 18) · ×1
  • KtorDownloadsGateway.transferAsset (cognitive 18) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/infrastructure/KtorDownloadsGateway.kt:144 — KtorDownloadsGateway.transferAsset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PdfRangeLoader.missingRanges (cognitive 18) · ×1
  • PdfRangeLoader.missingRanges (cognitive 18) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/application/PdfRangeLoader.kt:210 — PdfRangeLoader.missingRanges has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BookCoverView.body (cognitive 18) · ×1
  • BookCoverView.body (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:27 — BookCoverView.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 3 (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 · AdministrativeCopyCatalog.userFailure (cognitive 18) · ×1
  • AdministrativeCopyCatalog.userFailure (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsCopy.swift:83 — AdministrativeCopyCatalog.userFailure has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · IosComicNavigatorViewController.applyNavigationResult (cognitive 18) · ×1
  • IosComicNavigatorViewController.applyNavigationResult (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicNavigatorViewController.swift:606 — IosComicNavigatorViewController.applyNavigationResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4 (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 · IosPublicationSecurityPolicy.decode (cognitive 18) · ×1
  • IosPublicationSecurityPolicy.decode (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:251 — IosPublicationSecurityPolicy.decode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6 (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 · IosMobiPublicationFactory.build (cognitive 18) · ×1
  • IosMobiPublicationFactory.build (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiPublicationFactory.swift:74 — IosMobiPublicationFactory.build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 5, loops 3, 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.
D2 · Cognitive Complexity · IosReadiumRuntime.openEPUB (cognitive 18) · ×1
  • IosReadiumRuntime.openEPUB (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReadiumRuntime.swift:97 — IosReadiumRuntime.openEPUB has cognitive complexity 18 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 5 (7 pts), match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MultiDownloadSheet.resourceRow (cognitive 18) · ×1
  • MultiDownloadSheet.resourceRow (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:658 — MultiDownloadSheet.resourceRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 5 (8 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkDetailView.detailActions (cognitive 18) · ×1
  • WorkDetailView.detailActions (cognitive 18) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:731 — WorkDetailView.detailActions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 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 · ReaderV5ProgressSyncCoordinator.drain (cognitive 18) · ×1
  • ReaderV5ProgressSyncCoordinator.drain (cognitive 18) apps/web/lib/reader/v5-sync-coordinator.ts:382 — ReaderV5ProgressSyncCoordinator.drain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (2 pts), ternaries 1 (2 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 · recognized-metadata.currentMetadataValue (cognitive 18) · ×1
  • recognized-metadata.currentMetadataValue (cognitive 18) apps/web/features/books/model/recognized-metadata.ts:73 — recognized-metadata.currentMetadataValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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 · client.searchSourceNodeMetadata (cognitive 18) · ×1
  • client.searchSourceNodeMetadata (cognitive 18) apps/web/features/books/api/client.ts:364 — client.searchSourceNodeMetadata has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, boolean chains 7, if/else 2. Of this number, 10 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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 · metadata-lookup-modal.MetadataLookupModal · ×1
  • metadata-lookup-modal.MetadataLookupModal::applySelected (cognitive 18) apps/web/features/books/metadata-lookup-modal.tsx:242 — metadata-lookup-modal.MetadataLookupModal::applySelected has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, ternaries 2 (3 pts), error handling 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. This shape REPEATS in the file: one other method here (metadata-lookup-modal.MetadataLookupModal) 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 · login-page.LoginPage (cognitive 18) · ×1
  • login-page.LoginPage (cognitive 18) apps/web/features/settings/login-page.tsx:34 — login-page.LoginPage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 5, ternaries 2 (3 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (submit, a function literal at line 51, a function literal at line 60). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · import-preferences-panel.ImportPreferencesPanel (cognitive 18) · ×1
  • import-preferences-panel.ImportPreferencesPanel (cognitive 18) apps/web/features/settings/center/import-preferences-panel.tsx:49 — import-preferences-panel.ImportPreferencesPanel has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (9 pts), boolean chains 6, if/else 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 73, savePreferences, a function literal at line 141, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · strict-fb2-parser.decodeXmlEntities (cognitive 18) · ×1
  • strict-fb2-parser.decodeXmlEntities (cognitive 18) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:92 — strict-fb2-parser.decodeXmlEntities has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · http.mutate_download_task (cognitive 17) · ×1
  • http.mutate_download_task (cognitive 17) apps/api-python/app/modules/download/presentation/http.py:356 — http.mutate_download_task has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · library_queries.list_import_tasks_page (cognitive 17) · ×1
  • library_queries.list_import_tasks_page (cognitive 17) apps/api-python/app/modules/imports/infrastructure/library_queries.py:261 — library_queries.list_import_tasks_page has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SqlAlchemyLibraryImportTaskQueue.request_import_resource (cognitive 17) · ×1
  • SqlAlchemyLibraryImportTaskQueue.request_import_resource (cognitive 17) apps/api-python/app/modules/imports/infrastructure/readable_resource/task_queue.py:627 — SqlAlchemyLibraryImportTaskQueue.request_import_resource has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SqlAlchemyImportedBookMetadata.apply (cognitive 17) · ×1
  • SqlAlchemyImportedBookMetadata.apply (cognitive 17) apps/api-python/app/modules/library/infrastructure/imported_book_metadata.py:240 — SqlAlchemyImportedBookMetadata.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyBookResourceRepository.refresh_audio_resource_aggregates (cognitive 17) · ×1
  • SqlAlchemyBookResourceRepository.refresh_audio_resource_aggregates (cognitive 17) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1688 — SqlAlchemyBookResourceRepository.refresh_audio_resource_aggregates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 2, 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 · FilesystemResourcePreview._source (cognitive 17) · ×1
  • FilesystemResourcePreview._source (cognitive 17) apps/api-python/app/modules/media/infrastructure/resource_preview.py:79 — FilesystemResourcePreview._source has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 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 · fb2_adapter._render_element (cognitive 17) · ×1
  • fb2_adapter._render_element (cognitive 17) REDACTED:363 — fb2_adapter._render_element has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · locator_dom._sanitize_uri_attribute_value (cognitive 17) · ×1
  • locator_dom._sanitize_uri_attribute_value (cognitive 17) REDACTED:400 — locator_dom._sanitize_uri_attribute_value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 1 (2 pts), 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 · organize_service.parse_douban_search_html (cognitive 17) · ×1
  • organize_service.parse_douban_search_html (cognitive 17) REDACTED:541 — organize_service.parse_douban_search_html has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 3 (5 pts), if/else 3 (4 pts), error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdministrativeSettingsUiKt.AdministrativeSettingsDestination (cognitive 17) · ×1
  • AdministrativeSettingsUiKt.AdministrativeSettingsDestination (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt:70 — AdministrativeSettingsUiKt.AdministrativeSettingsDestination has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AdministrativeSettingsViewModel.load (cognitive 17) · ×1
  • AdministrativeSettingsViewModel.load (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsViewModel.kt:37 — AdministrativeSettingsViewModel.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2, boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AdministrativeSystemScreensKt.OpdsScreen (cognitive 17) · ×1
  • AdministrativeSystemScreensKt.OpdsScreen (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSystemScreens.kt:76 — AdministrativeSystemScreensKt.OpdsScreen has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · HomeScreenKt.HomeScreen (cognitive 17) · ×1
  • HomeScreenKt.HomeScreen (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/home/ui/HomeScreen.kt:58 — HomeScreenKt.HomeScreen has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LibraryViewModel.refreshAfterManagement (cognitive 17) · ×1
  • LibraryViewModel.refreshAfterManagement (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/application/LibraryViewModel.kt:183 — LibraryViewModel.refreshAfterManagement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (2 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 · ComicNavigatorFragment.ComicPageImage (cognitive 17) · ×1
  • ComicNavigatorFragment.ComicPageImage (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ComicNavigatorFragment.kt:559 — ComicNavigatorFragment.ComicPageImage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · EpubContentSecurityPolicy.prepareResourceBytes (cognitive 17) · ×1
  • EpubContentSecurityPolicy.prepareResourceBytes (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/EpubContentSecurityPolicy.kt:251 — EpubContentSecurityPolicy.prepareResourceBytes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 4 (7 pts), boolean chains 3 (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 · ReaderActivity.openServerReader (cognitive 17) · ×1
  • ReaderActivity.openServerReader (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:502 — ReaderActivity.openServerReader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (4 pts), boolean chains 2, match/switch 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 · ReaderScreenKt.ReaderPreferenceSection (cognitive 17) · ×1
  • ReaderScreenKt.ReaderPreferenceSection (cognitive 17) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderScreen.kt:1336 — ReaderScreenKt.ReaderPreferenceSection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KtorAudioMediaTransportKt.validate (cognitive 17) · ×1
  • KtorAudioMediaTransportKt.validate (cognitive 17) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/infrastructure/KtorAudioMediaTransport.kt:109 — KtorAudioMediaTransportKt.validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · XmlControlPreprocessor.removeDeclarations (cognitive 17) · ×1
  • XmlControlPreprocessor.removeDeclarations (cognitive 17) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:595 — XmlControlPreprocessor.removeDeclarations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · XmlControlPreprocessor.replaceReferences (cognitive 17) · ×1
  • XmlControlPreprocessor.replaceReferences (cognitive 17) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/domain/ReaderSafetyFacade.kt:680 — XmlControlPreprocessor.replaceReferences has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KtorReaderBootstrapGateway.validateBeforeSecondaryRequest (cognitive 17) · ×1
  • KtorReaderBootstrapGateway.validateBeforeSecondaryRequest (cognitive 17) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/reader/infrastructure/KtorReaderBootstrapGateway.kt:107 — KtorReaderBootstrapGateway.validateBeforeSecondaryRequest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BookDetailStore.load (cognitive 17) · ×1
  • BookDetailStore.load (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Application/ContentStores.swift:773 — BookDetailStore.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 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 · IosPdfiumDownloadMaterializer.materialize (cognitive 17) · ×1
  • IosPdfiumDownloadMaterializer.materialize (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:30 — IosPdfiumDownloadMaterializer.materialize has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · IosPdfiumDocument.render (cognitive 17) · ×1
  • IosPdfiumDocument.render (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfiumDocument.swift:326 — IosPdfiumDocument.render has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ReaderTOCSheet.body (cognitive 17) · ×1
  • ReaderTOCSheet.body (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosReaderControlSheets.swift:38 — ReaderTOCSheet.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShelfCatalogStore.loadMore (cognitive 17) · ×1
  • ShelfCatalogStore.loadMore (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Shelves/ShelfCatalogStore.swift:76 — ShelfCatalogStore.loadMore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 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 · MultiDownloadSheet.body (cognitive 17) · ×1
  • MultiDownloadSheet.body (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:389 — MultiDownloadSheet.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (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 · WorkDetailView.saveShelves (cognitive 17) · ×1
  • WorkDetailView.saveShelves (cognitive 17) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:2014 — WorkDetailView.saveShelves has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2, error handling 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 · cover.Cover (cognitive 17) · ×1
  • cover.Cover (cognitive 17) apps/web/components/book/cover.tsx:30 — cover.Cover has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · feedback.FeedbackProvider (cognitive 17) · ×1
  • feedback.FeedbackProvider (cognitive 17) apps/web/components/ui/feedback.tsx:56 — feedback.FeedbackProvider has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 2 (nesting depth added 6). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · smart-filter-builder.SmartFilterBuilder · ×1
  • smart-filter-builder.SmartFilterBuilder::valueEditor (cognitive 17) apps/web/features/library/smart-filter-builder.tsx:117 — smart-filter-builder.SmartFilterBuilder::valueEditor has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 5, boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · book-detail-page.ResourceEditor (cognitive 17) · ×1
  • book-detail-page.ResourceEditor (cognitive 17) apps/web/features/books/book-detail-page.tsx:127 — book-detail-page.ResourceEditor has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, ternaries 4 (5 pts), error handling 1, if/else 1 (nesting depth added 1). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (save, a function literal at line 143). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · audio-listen-redirect.AudioListenRedirect (cognitive 17) · ×1
  • audio-listen-redirect.AudioListenRedirect (cognitive 17) apps/web/features/audio/audio-listen-redirect.tsx:10 — audio-listen-redirect.AudioListenRedirect has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 5, if/else 4 (5 pts) (nesting depth added 4). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 30). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · input-router.readerKeyIntent (cognitive 17) · ×1
  • input-router.readerKeyIntent (cognitive 17) apps/web/features/reader/v3/input-router.ts:62 — input-router.readerKeyIntent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 7. 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 · mobi-worker-client.response (cognitive 17) · ×1
  • mobi-worker-client.response (cognitive 17) apps/web/features/reader/v3/original-publication/mobi-worker-client.ts:84 — mobi-worker-client.response has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 6, boolean chains 4 (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 · readium-publication.chapterXmlEvents (cognitive 17) · ×1
  • readium-publication.chapterXmlEvents (cognitive 17) apps/web/features/reader/v3/adapters/readium-publication.ts:70 — readium-publication.chapterXmlEvents has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 4, if/else 3 (4 pts), loops 1 (nesting depth added 3). None of this is in the body itself: all 17 points belong to 2 function items inside it that branch (visit, a function literal at line 95). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · backups-client.parseBackup (cognitive 17) · ×1
  • backups-client.parseBackup (cognitive 17) apps/web/features/settings/api/backups-client.ts:40 — backups-client.parseBackup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · library-scan-settings-panel.LibraryScanSettingsPanel (cognitive 17) · ×1
  • library-scan-settings-panel.LibraryScanSettingsPanel (cognitive 17) apps/web/features/settings/center/library-scan-settings-panel.tsx:16 — library-scan-settings-panel.LibraryScanSettingsPanel has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 4, if/else 2, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (save, a function literal at line 32, a function literal at line 35, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · 0031_book_import_task_backfill._merge_pending (cognitive 16) · ×1
  • 0031_book_import_task_backfill._merge_pending (cognitive 16) apps/api-python/app/db/alembic/versions/0031_book_import_task_backfill.py:53 — 0031_book_import_task_backfill._merge_pending has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (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 · copied_file_attributes.apply_copy_attributes (cognitive 16) · ×1
  • copied_file_attributes.apply_copy_attributes (cognitive 16) apps/api-python/app/infrastructure/copied_file_attributes.py:248 — copied_file_attributes.apply_copy_attributes has cognitive complexity 16 (threshold 15). Drivers by points: error handling 6 (9 pts), if/else 5 (6 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpdsMediaResources._cover (cognitive 16) · ×1
  • OpdsMediaResources._cover (cognitive 16) apps/api-python/app/infrastructure/opds_runtime.py:635 — OpdsMediaResources._cover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 1 (2 pts) (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 · ScanLibrarySourceTree._persist_directory_decision (cognitive 16) · ×1
  • ScanLibrarySourceTree._persist_directory_decision (cognitive 16) apps/api-python/app/modules/imports/application/readable_resource/scan_source_tree.py:1145 — ScanLibrarySourceTree._persist_directory_decision has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SqlAlchemyLibraryQueries._matching_statement (cognitive 16) · ×1
  • SqlAlchemyLibraryQueries._matching_statement (cognitive 16) apps/api-python/app/modules/library/infrastructure/queries.py:56 — SqlAlchemyLibraryQueries._matching_statement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · http.get_resource_page (cognitive 16) · ×1
  • http.get_resource_page (cognitive 16) apps/api-python/app/modules/media/presentation/http.py:460 — http.get_resource_page has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, ternaries 3 (6 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetadataMatch.application_candidate (cognitive 16) · ×1
  • MetadataMatch.application_candidate (cognitive 16) apps/api-python/app/modules/metadata/infrastructure/matching.py:49 — MetadataMatch.application_candidate has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), loops 2 (3 pts), 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 · AnchoredStandardMetadataReader.read (cognitive 16) · ×1
  • AnchoredStandardMetadataReader.read (cognitive 16) apps/api-python/app/modules/metadata/infrastructure/standard_files.py:139 — AnchoredStandardMetadataReader.read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 2 (4 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · writeback_queue.enqueue_prepared_writeback_intents (cognitive 16) · ×1
  • writeback_queue.enqueue_prepared_writeback_intents (cognitive 16) apps/api-python/app/modules/metadata/infrastructure/writeback_queue.py:371 — writeback_queue.enqueue_prepared_writeback_intents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 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 · xml_policy._scan_doctypes (cognitive 16) · ×1
  • xml_policy._scan_doctypes (cognitive 16) REDACTED:213 — xml_policy._scan_doctypes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 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 · UpdateShelf.execute (cognitive 16) · ×1
  • UpdateShelf.execute (cognitive 16) apps/api-python/app/modules/shelf/application/commands.py:179 — UpdateShelf.execute has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5, ternaries 4, error handling 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 · events.prepare_event_metadata (cognitive 16) · ×1
  • events.prepare_event_metadata (cognitive 16) apps/api-python/app/modules/system/domain/events.py:41 — events.prepare_event_metadata has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 3 (7 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · PreparationWorker._run (cognitive 16) · ×1
  • PreparationWorker._run (cognitive 16) apps/api-python/app/modules/updates/infrastructure/preparation_worker.py:262 — PreparationWorker._run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 4 (6 pts), boolean chains 2 (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 · audio_metadata._mutagen_cover (cognitive 16) · ×1
  • audio_metadata._mutagen_cover (cognitive 16) apps/api-python/app/services/audio_metadata.py:834 — audio_metadata._mutagen_cover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), ternaries 2 (5 pts), boolean chains 3, error handling 2 (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 · organize_service.parse_douban_subject_html (cognitive 16) · ×1
  • organize_service.parse_douban_subject_html (cognitive 16) REDACTED:459 — organize_service.parse_douban_subject_html has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 5, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · organize_service.run_bangumi_metadata_provider (cognitive 16) · ×1
  • organize_service.run_bangumi_metadata_provider (cognitive 16) REDACTED:958 — organize_service.run_bangumi_metadata_provider has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Benchmark.resources (cognitive 16) · ×1
  • Benchmark.resources (cognitive 16) apps/api-python/scripts/benchmark_nas_import.py:179 — Benchmark.resources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · check-reader-safety-boundaries.check_source_ownership (cognitive 16) · ×1
  • check-reader-safety-boundaries.check_source_ownership (cognitive 16) packages/reader-contracts/check-reader-safety-boundaries.py:213 — check-reader-safety-boundaries.check_source_ownership has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (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 · AdministrativeSettingsViewModel.poll (cognitive 16) · ×1
  • AdministrativeSettingsViewModel.poll (cognitive 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsViewModel.kt:82 — AdministrativeSettingsViewModel.poll has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AndroidAudioPlaybackRuntime.publishFromController (cognitive 16) · ×1
  • AndroidAudioPlaybackRuntime.publishFromController (cognitive 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt:1115 — AndroidAudioPlaybackRuntime.publishFromController has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MultiDownloadSheetKt.SelectionBatchBar (cognitive 16) · ×1
  • MultiDownloadSheetKt.SelectionBatchBar (cognitive 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:820 — MultiDownloadSheetKt.SelectionBatchBar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ReaderActivity.dispatchKeyEvent (cognitive 16) · ×1
  • ReaderActivity.dispatchKeyEvent (cognitive 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:303 — ReaderActivity.dispatchKeyEvent has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ReaderActivity.openManagedDownload (cognitive 16) · ×1
  • ReaderActivity.openManagedDownload (cognitive 16) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/presentation/ReaderActivity.kt:748 — ReaderActivity.openManagedDownload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ManagementActionsKt.managementActions (cognitive 16) · ×1
  • ManagementActionsKt.managementActions (cognitive 16) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/domain/ManagementActions.kt:19 — ManagementActionsKt.managementActions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MetadataProviderDetailView.editableField (cognitive 16) · ×1
  • MetadataProviderDetailView.editableField (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:108 — MetadataProviderDetailView.editableField has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AudioPlaybackRuntime.launchVerifiedLocalArtifact (cognitive 16) · ×1
  • AudioPlaybackRuntime.launchVerifiedLocalArtifact (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackRuntime.swift:172 — AudioPlaybackRuntime.launchVerifiedLocalArtifact has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, error handling 4 (6 pts), if/else 3 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DownloadedBookView.perform (cognitive 16) · ×1
  • DownloadedBookView.perform (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Downloads/DownloadCenterView.swift:168 — DownloadedBookView.perform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IosComicReaderSession.restorePage (cognitive 16) · ×1
  • IosComicReaderSession.restorePage (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:274 — IosComicReaderSession.restorePage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · IosReflowableReaderSession.verifyNavigation (cognitive 16) · ×1
  • IosReflowableReaderSession.verifyNavigation (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:897 — IosReflowableReaderSession.verifyNavigation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MultiDownloadTreeStore.load (cognitive 16) · ×1
  • MultiDownloadTreeStore.load (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Work/MultiDownloadSheet.swift:56 — MultiDownloadTreeStore.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 4 (6 pts), ternaries 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 · NativeManagementSheet.body (cognitive 16) · ×1
  • NativeManagementSheet.body (cognitive 16) apps/mobile/iosApp/ErmaoLibrary/Features/Work/NativeBookManagement.swift:886 — NativeManagementSheet.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, match/switch 2, 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 · book-download-dialog.BookDownloadDialog (cognitive 16) · ×1
  • book-download-dialog.BookDownloadDialog (cognitive 16) apps/web/features/books/ui/book-download-dialog.tsx:101 — book-download-dialog.BookDownloadDialog has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 5 function items inside it that branch (sizeLabel, a function literal at line 119, a function literal at line 125, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ComicReaderAdapter.executeAdjacentStep (cognitive 16) · ×1
  • ComicReaderAdapter.executeAdjacentStep (cognitive 16) apps/web/features/reader/v3/adapters/comic-adapter.ts:467 — ComicReaderAdapter.executeAdjacentStep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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 · generate-i18n-catalog.collectTypeScriptMessages (cognitive 16) · ×1
  • generate-i18n-catalog.collectTypeScriptMessages (cognitive 16) apps/web/scripts/generate-i18n-catalog.mjs:52 — generate-i18n-catalog.collectTypeScriptMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 5). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · generate-reader-safety-conformance.executableCases (cognitive 16) · ×1
  • generate-reader-safety-conformance.executableCases (cognitive 16) REDACTED:236 — generate-reader-safety-conformance.executableCases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (55 shared lines) · ×1
  • Near-duplicate member pair (55 shared lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:306 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:306-396 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/core/network/ApiClient.kt:409-493 — These two members are variants of one another: 55 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) apps/api-python/app/modules/automation/application/uploads.py:185 — apps/api-python/app/modules/automation/application/uploads.py:185-289 | apps/api-python/app/modules/automation/application/uploads.py:330-455 | apps/api-python/app/modules/automation/application/uploads.py:502-563 | apps/api-python/app/modules/library/application/execute_file_moves.py:87-265 | apps/api-python/app/modules/library/application/file_deletions.py:153-279 | apps/api-python/app/modules/library/application/file_move_worker.py:33-86 | apps/api-python/app/modules/metadata/application/execute_standard_writeback.py:88-203 — 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 · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:11 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:11-64 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:11-65 — These two members are one piece of code written twice and then edited apart: 54 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 (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) apps/api-python/app/modules/library/infrastructure/resource_cover.py:59 — apps/api-python/app/modules/library/infrastructure/resource_cover.py:59-107 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:35-83 — These two members are one piece of code written twice and then edited apart: 49 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 (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:47 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ImageDirectoryReadiumPublicationFactory.kt:47-97 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/RemoteComicReadiumPublicationFactory.kt:32-82 — These two members are one piece of code written twice and then edited apart: 51 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 (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) apps/api-python/app/modules/media/infrastructure/http_streaming.py:1216 — apps/api-python/app/modules/media/infrastructure/http_streaming.py:1216-1272 | apps/api-python/app/modules/media/infrastructure/http_streaming.py:1285-1360 — These two members are one piece of code written twice and then edited apart: 57 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 (43 corresponding lines) · ×1
  • Edited copy of a member (43 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:259 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:259-302 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosImageDirectoryPublicationFactory.swift:183-225 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:115 — apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:115-151 | apps/mobile/iosApp/ErmaoLibrary/Design/ContentComponents.swift:177-216 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1202 — apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1202-1234 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1236-1275 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) apps/api-python/app/modules/kindle/infrastructure/tasks.py:340 — apps/api-python/app/modules/kindle/infrastructure/tasks.py:340-369 | apps/api-python/app/modules/kindle/infrastructure/tasks.py:375-414 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 19+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:66 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:66-84 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderView.swift:125-146 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:67-89 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) apps/api-python/app/modules/library/infrastructure/projections.py:155 — apps/api-python/app/modules/library/infrastructure/projections.py:155-179 | apps/api-python/app/modules/organize/infrastructure/job_queries.py:397-431 — 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 copies of one member (3 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:357 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumComicSession.kt:357-388 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumEpubSession.kt:703-732 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/ReadiumPdfSession.kt:363-393 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:541 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/KtorContentRepository.kt:541-577 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/infrastructure/WorkDetailQueryWire.kt:136-169 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:393 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:393-419 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1292-1315 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:435-458 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 16+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:342 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderSession.swift:342-359 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosEpubReaderSession.swift:1333-1348 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderSession.swift:265-281 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) apps/api-python/app/modules/backup/presentation/http.py:158 — apps/api-python/app/modules/backup/presentation/http.py:158-175 | apps/api-python/app/modules/backup/presentation/http.py:206-232 | apps/api-python/app/modules/backup/presentation/http.py:244-261 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 17+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 17+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:141 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:141-159 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:161-177 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:179-195 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosMobiContentSanitizer.swift:197-213 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 11+ corresponding lines) apps/api-python/app/modules/automation/presentation/http.py:90 — apps/api-python/app/modules/automation/presentation/http.py:90-106 | apps/api-python/app/modules/automation/presentation/http.py:212-222 | apps/api-python/app/modules/automation/presentation/http.py:229-253 | apps/api-python/app/modules/automation/presentation/http.py:260-281 | apps/api-python/app/modules/automation/presentation/http.py:288-300 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 11+ corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:411 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:411-421 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:423-433 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/audio/application/AudioSessionStateMachine.kt:436-446 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/infrastructure/KtorAuthGateway.kt:42 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/infrastructure/KtorAuthGateway.kt:42-60 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/infrastructure/KtorAuthGateway.kt:66-84 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/infrastructure/KtorAuthGateway.kt:129-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 15+ corresponding lines) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/bootstrap/IosComposition.kt:177 — apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/bootstrap/IosComposition.kt:177-195 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/downloads/public.kt:101-119 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/library/public.kt:55-69 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/shelf/public.kt:35-49 | apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/public.kt:61-75 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 1+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:184 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/MetadataSettingsViews.swift:184-184 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/OrganizationSettingsViews.swift:181-181 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SystemSettingsViews.swift:308-308 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 4+ corresponding lines) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:101 — apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:101-104 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:105-108 | apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/SharedAdministrativeSettingsClient.swift:109-112 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) apps/api-python/app/modules/library/infrastructure/file_deletions.py:73 — apps/api-python/app/modules/library/infrastructure/file_deletions.py:73-84 | apps/api-python/app/modules/library/infrastructure/file_move_operations.py:59-72 | apps/api-python/app/modules/library/infrastructure/file_move_operations.py:121-133 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 5+ corresponding lines) apps/api-python/app/db/alembic/versions/0047_source_cleanup_page_index.py:14 — apps/api-python/app/db/alembic/versions/0047_source_cleanup_page_index.py:14-18 | apps/api-python/app/db/alembic/versions/0048_import_task_state_totals.py:14-18 | apps/api-python/app/db/alembic/versions/0050_book_import_status_page.py:14-18 | apps/api-python/app/db/alembic/versions/0051_book_search_cover_index.py:14-22 | apps/api-python/app/db/alembic/versions/0052_directory_member_cover_index.py:15-19 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 3+ corresponding lines) apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:412 — apps/api-python/app/modules/library/infrastructure/recognized_metadata.py:412-414 | apps/api-python/app/modules/library/infrastructure/resource_cover.py:133-135 | apps/api-python/app/modules/library/infrastructure/source_node_cover.py:109-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 2+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 2+ corresponding lines) apps/api-python/app/modules/backup/infrastructure/persistence.py:83 — apps/api-python/app/modules/backup/infrastructure/persistence.py:83-84 | apps/api-python/app/modules/download/infrastructure/tasks.py:29-30 | apps/api-python/app/modules/kindle/infrastructure/tasks.py:37-38 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 2 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (91 lines × 2) · ×1
  • Duplicated block (91 lines × 2) apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:78 — apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py:78-168 | apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py:79-169 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0019_backfill_scan_gaps.py` and `apps/api-python/app/db/alembic/versions/0020_recheck_scan_gaps.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 121 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (83 lines × 2) · ×1
  • Duplicated block (83 lines × 2) apps/api-python/app/db/alembic/versions/0013_image_resource_tasks.py:13 — apps/api-python/app/db/alembic/versions/0013_image_resource_tasks.py:13-95 | apps/api-python/app/db/alembic/versions/0014_audio_resource_tasks.py:13-95 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0013_image_resource_tasks.py` and `apps/api-python/app/db/alembic/versions/0014_audio_resource_tasks.py` as WHOLE FILES: 91% 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. If that is what happened, the fix is to keep one copy and have the 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 (43–46 lines × 2) · ×1
  • Duplicated block (43–46 lines × 2) apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.py:43 — apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.py:43-85 | apps/api-python/app/db/alembic/versions/0030_book_import_task_shape.py:34-79 — 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 `apps/api-python/app/db/alembic/versions/0012_resource_import_tasks.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 (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) REDACTED:274 — REDACTED:274-307 | REDACTED:414-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×1
  • Duplicated block (26–28 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299-324 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:402-429 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299` 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 (15–27 lines × 4) · ×1
  • Duplicated block (15–27 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1754 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1754-1769 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1870-1896 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2015-2029 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2096-2122 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1754` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1898` calls `UniqueConstraint` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1771` 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 (20–27 lines × 2) · ×1
  • Duplicated block (20–27 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:464 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:464-490 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:590-609 — both copies are in the same file, so extract the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:464` 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 (21–27 lines × 2) · ×1
  • Duplicated block (21–27 lines × 2) apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:174 — apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:174-194 | apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:204-230 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/reader/infrastructure/v5_library_queries.py:174` 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–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) apps/api-python/app/modules/system/infrastructure/health_runs.py:810 — apps/api-python/app/modules/system/infrastructure/health_runs.py:810-831 | apps/api-python/app/modules/system/infrastructure/health_runs.py:842-864 — both copies are in the same file, so extract the 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 `apps/api-python/app/modules/system/infrastructure/health_runs.py:810` 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–21 lines × 3) · ×1
  • Duplicated block (17–21 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299-319 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:402-421 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:515-531 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:299` 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 (17–20 lines × 3) · ×1
  • Duplicated block (17–20 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:181 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:181-200 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:296-315 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:401-417 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:181` 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 (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2007 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2007-2026 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2180-2199 — both copies are in the same file, so extract the 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–19 lines × 4) · ×1
  • Duplicated block (16–19 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:817 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:817-835 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1295-1311 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1973-1988 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2035-2051 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:817` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1292` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1970` 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 (18 lines × 7) · ×1
  • Duplicated block (18 lines × 7) apps/api-python/app/modules/automation/application/uploads.py:271 — apps/api-python/app/modules/automation/application/uploads.py:271-288 | apps/api-python/app/modules/automation/application/uploads.py:405-422 | apps/api-python/app/modules/automation/application/uploads.py:539-556 | apps/api-python/app/modules/library/application/execute_file_moves.py:232-249 | apps/api-python/app/modules/library/application/file_deletions.py:244-261 | apps/api-python/app/modules/library/application/file_move_worker.py:68-85 | apps/api-python/app/modules/metadata/application/execute_standard_writeback.py:148-165 — there are 7 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 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, `apps/api-python/app/modules/automation/application/uploads.py:270` calls `view` and `apps/api-python/app/modules/library/application/execute_file_moves.py:231` 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 lines × 5) · ×1
  • Duplicated block (17 lines × 5) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515-1531 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1588-1604 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1622-1638 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:96-112 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:180-196 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1514` calls `Column`, `BigInteger` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:179` 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 (15–17 lines × 4) · ×1
  • Duplicated block (15–17 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:149 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:149-163 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:355-369 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:472-488 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:591-607 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–17 lines × 3) · ×1
  • Duplicated block (13–17 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:249 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:249-261 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:294-310 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:329-341 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–17 lines × 3) · ×1
  • Duplicated block (15–17 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1684 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1684-1698 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1748-1764 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2023-2039 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1684` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–17 lines × 3) · ×1
  • Duplicated block (2–17 lines × 3) apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:17 — apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:17-33 | apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:55-56 | apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py:17-33 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py` and `apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:17` 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, `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:34` calls `Column`, `String` and `apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py:34` 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 (15–16 lines × 4) · ×1
  • Duplicated block (15–16 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1682 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1682-1696 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1746-1760 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2020-2035 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2113-2128 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2020` 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 × 3) · ×1
  • Duplicated block (15–16 lines × 3) REDACTED:691 — REDACTED:691-705 | REDACTED:661-676 | apps/api-python/app/modules/publications/infrastructure/txt_adapter.py:214-229 — 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 `REDACTED:691` 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.
D4 · Code Duplication · Duplicated block (11–14 lines × 6) · ×1
  • Duplicated block (11–14 lines × 6) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:745 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:745-755 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:766-778 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1354-1364 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1428-1438 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:130-142 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:173-186 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:745` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:744` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:765` 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 (12–14 lines × 5) · ×1
  • Duplicated block (12–14 lines × 5) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:808 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:808-821 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1678-1689 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1742-1753 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1866-1879 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2092-2105 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:808` 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 (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515-1527 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1588-1600 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1622-1634 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:96-108 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:135-148 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:179-192 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1514` calls `Column`, `BigInteger`, `ForeignKeyConstraint` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:179` 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 (10–13 lines × 3) · ×1
  • Duplicated block (10–13 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:753 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:753-763 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1436-1448 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1459-1468 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:753` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1451` calls `Column`, `Text` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:766` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1820 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1820-1832 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:92-104 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:137-149 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1820` 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) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1513 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1513-1524 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1586-1597 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1621-1631 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1969-1980 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:95-105 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1513` 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–12 lines × 4) · ×1
  • Duplicated block (10–12 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:750 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:750-759 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1359-1369 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1433-1443 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1555-1566 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:750` 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 (9–11 lines × 18) · ×1
  • Duplicated block (9–11 lines × 18) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:717 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:717-725 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:805-815 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1126-1134 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1185-1193 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1209-1217 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1233-1241 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1330-1338 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1396-1404 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1452-1460 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1474-1482 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1508-1516 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1581-1589 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1675-1685 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1739-1749 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1863-1873 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1930-1939 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1964-1972 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2089-2099 — all 18 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:717` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1929` calls `String` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:805` 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–11 lines × 5) · ×1
  • Duplicated block (10–11 lines × 5) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1044 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1044-1054 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1144-1153 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1173-1182 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1565-1574 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1912-1921 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1044` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1170` calls `create_index` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1564` 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–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:724 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:724-731 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1766-1776 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1938-1945 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:724` 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) apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:640 — apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:640-650 | apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1263-1272 | apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:1356-1365 — 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 `apps/api-python/app/modules/library/infrastructure/persistence/source_tree_repository.py:640` 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 (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:69 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:69-78 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:236-247 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:311-322 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:413-424 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×1
  • Duplicated block (10 lines × 3) REDACTED:105 — REDACTED:105-114 | REDACTED:161-170 | REDACTED:151-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:150` calls `parser` and `REDACTED:160` 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 (3–9 lines × 8) · ×1
  • Duplicated block (3–9 lines × 8) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:911 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:911-919 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:936-943 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:976-978 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1124-1131 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1673-1680 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1737-1744 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1861-1868 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1962-1969 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:911` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1122` calls `Column`, `Text`, `BigInteger` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:976` 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 lines × 4) · ×1
  • Duplicated block (9 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629-637 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:914-922 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:981-989 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1061-1069 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:629` 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–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:661 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:661-669 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1283-1291 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1507-1514 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:661` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1292` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1515` 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 (8 lines × 9) · ×1
  • Duplicated block (8 lines × 9) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:628 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:628-635 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:913-920 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:937-944 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1060-1067 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1125-1132 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1674-1681 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1738-1745 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1862-1869 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1963-1970 — all 9 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:946` calls `UniqueConstraint` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:637` 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 (7–8 lines × 8) · ×1
  • Duplicated block (7–8 lines × 8) apps/api-python/app/modules/opds/presentation/http.py:266 — apps/api-python/app/modules/opds/presentation/http.py:266-273 | apps/api-python/app/modules/opds/presentation/http.py:303-309 | apps/api-python/app/modules/opds/presentation/http.py:314-320 | apps/api-python/app/modules/opds/presentation/http.py:334-340 | apps/api-python/app/modules/opds/presentation/http.py:346-353 | apps/api-python/app/modules/opds/presentation/http.py:367-373 | apps/api-python/app/modules/opds/presentation/http.py:379-385 | apps/api-python/app/modules/opds/presentation/http.py:391-398 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/modules/opds/presentation/http.py:266` 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 (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:764 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:764-771 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1328-1335 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1352-1359 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1426-1433 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1544-1551 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:128-135 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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, `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:126` calls `Column`, `String` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:763` 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) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1047 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1047-1054 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1147-1153 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1176-1182 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1539-1547 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1568-1574 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1915-1921 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1047` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–6 lines × 17) · ×1
  • Duplicated block (2–6 lines × 17) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:738 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:738-743 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:760-765 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:784-791 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1087-1089 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1201-1206 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1254-1259 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1320-1327 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1372-1377 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1422-1427 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1443-1450 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1465-1470 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1656-1657 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1988-1995 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1996-1997 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2071-2073 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:2156-2163 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:27-29 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:738` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:744` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:766` 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 (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:919 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:919-925 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:963-968 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1066-1072 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1079-1085 — 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:919` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 12) · ×1
  • Duplicated block (5 lines × 12) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:648 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:648-653 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:965-969 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1048-1054 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1082-1086 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1148-1153 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1177-1182 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1569-1574 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1840-1844 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1916-1921 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:83-88 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:122-127 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:156-161 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:163` calls `Column`, `String` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1576` 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 × 4) · ×1
  • Duplicated block (5 lines × 4) apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:13 — apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:13-17 | apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py:13-17 | apps/api-python/app/db/alembic/versions/0027_automation_uploads.py:13-17 | apps/api-python/app/db/alembic/versions/0029_file_deletions.py:13-17 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py` and `apps/api-python/app/db/alembic/versions/0025_standard_writeback_plans.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0023_file_move_operations.py:13` 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) apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1615 — apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1615-1617 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1810-1811 | apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1814-1818 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:125-127 | apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py:131-135 | apps/api-python/app/db/alembic/versions/0009_reader_v5_opaque_progress.py:90-92 — before extracting anything, compare `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py` and `apps/api-python/app/db/alembic/versions/0005_asset_navigation_marker.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1814` 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, `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1810` calls `Column`, `Integer` and `apps/api-python/app/db/alembic/versions/0001_library_topology_baseline.py:1615` 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 lines × 3) · ×1
  • Duplicated block (17 lines × 3) apps/api-python/app/modules/download/application/commands.py:11 — apps/api-python/app/modules/download/application/commands.py:11-27 | apps/api-python/app/modules/kindle/application/commands.py:8-31 | apps/api-python/app/modules/metadata/application/commands.py:10-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.
D4 · Code Duplication · Duplicated block (52 lines × 2) · ×1
  • Duplicated block (52 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1005 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1005-1056 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt:1104-1155 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/ui/AudioPlayerUi.kt: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.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/theme/WarmPageTheme.kt:149 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/theme/WarmPageTheme.kt:149-180 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/ui/theme/WarmPageTheme.kt:188-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:489 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:489-516 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:524-551 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:489` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:495 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:495-516 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:530-551 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:587-608 — 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/MultiDownloadSheet.kt:495` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:342 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:342-357 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:783-800 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/shell/MainShell.kt:342` 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–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1431 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1431-1442 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1730-1742 — both copies are in the same file, so extract the 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 `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/library/ui/WorkDetailScreen.kt:1431` 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 (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:256 — apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:256-262 | apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:276-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/servers/ServerScreens.kt:256` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:43 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:43-64 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:44-65 — before extracting anything, compare `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:43` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosPdfReaderView.swift:43` calls `applySavedZoomAfterPresentation` and `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosComicReaderView.swift:42` 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 (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:746 — apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:746-766 | apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:907-927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/iosApp/ErmaoLibrary/Features/Audio/IosAudioPlaybackViews.swift:746` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:130 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:130-146 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosImageDirectoryPublicationFactory.swift:206-220 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:136 — apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:136-151 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:287-300 | apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosImageDirectoryPublicationFactory.swift:210-223 — 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Reader/IosCbzPublicationFactory.swift:136` 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. 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 (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:64 — apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:64-74 | apps/mobile/iosApp/ErmaoLibrary/Features/Library/FacetView.swift:54-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/mobile/iosApp/ErmaoLibrary/Features/Home/HomeView.swift:64` 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 × 2) · ×1
  • Duplicated block (10–11 lines × 2) apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1070 — apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1070-1079 | apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1463-1473 — both copies are in the same file, so extract the 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 `apps/mobile/iosApp/ErmaoLibrary/Features/Work/WorkDetailView.swift:1070` 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.
P8 · Schema migrations · Schema created by SQLAlchemy create_all() outside the migrations · ×1
  • Schema created by SQLAlchemy create_all() outside the migrations apps/feedback-receiver/receiver/app.py:67 — This repository versions its schema (Alembic), but SQLAlchemy create_all() here builds or alters the schema from the model as well, outside that history — the two paths can disagree about the shape, and a change made this way is never a reviewed migration. Turn it off and let Alembic own the schema.
R10 · Code Duplication · Duplication concentrated across 14 sibling directories (82 clone groups) · ×1
  • Duplication concentrated across 14 sibling directories (82 clone groups) apps/web/features/management/api/events.ts:19 — 82 duplicated blocks under apps/web/features/ have copies in at least two of the sibling directories audio, automation, books, dashboard, feedback, import-tasks (+8 more sibling(s) not listed) — 39 of them are reported below, and 43 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 82 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 82 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 82 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 5 sibling directories (30 clone groups) · ×1
  • Duplication concentrated across 5 sibling directories (30 clone groups) apps/web/components/directory/target-directory-picker.tsx:184 — 30 duplicated blocks under apps/web/ have copies in at least two of the sibling directories components, features, i18n, lib, scripts — 12 of them are reported below, and 18 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 30 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 30 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 30 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplicated block with local edits (112 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (112 matched lines × 2 locations) apps/web/components/ui/combobox.tsx:63 — apps/web/components/ui/combobox.tsx:63 · apps/web/components/ui/select.tsx:114 — the two spans are one implementation copied and then locally edited — 805 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 (106 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (106 matched lines × 2 locations) apps/web/components/ui/combobox.tsx:46 — apps/web/components/ui/combobox.tsx:46 · apps/web/components/ui/multi-value-combobox.tsx:89 — the two spans are one implementation copied and then locally edited — 813 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 (63 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (63 matched lines × 2 locations) scripts/python-api-runtime-smoke.mjs:25 — scripts/python-api-runtime-smoke.mjs:25 · scripts/python-worker-runtime-smoke.mjs:11 — the two spans are one implementation copied and then locally edited — 442 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 (58 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (58 matched lines × 2 locations) apps/web/components/layout/app-shell.tsx:895 — apps/web/components/layout/app-shell.tsx:895 · apps/web/components/layout/app-shell.tsx:1060 — the two spans are one implementation copied and then locally edited — 382 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (56 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (56 matched lines × 2 locations) REDACTED:24 — REDACTED:24 · scripts/python-api-runtime-smoke.mjs:11 — the two spans are one implementation copied and then locally edited — 395 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 (55 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (55 matched lines × 2 locations) apps/web/scripts/build-chapters-wasm.mjs:6 — apps/web/scripts/build-chapters-wasm.mjs:6 · apps/web/scripts/build-mobi-wasm.mjs:6 — the two spans are one implementation copied and then locally edited — 544 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 (52 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (52 matched lines × 2 locations) apps/web/components/ui/multi-value-combobox.tsx:92 — apps/web/components/ui/multi-value-combobox.tsx:92 · apps/web/components/ui/select.tsx:104 — the two spans are one implementation copied and then locally edited — 474 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 (48 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (48 matched lines × 2 locations) apps/web/features/management/api/events.ts:19 — apps/web/features/management/api/events.ts:19 · apps/web/features/organize/api/facets.ts:15 — the two spans are one implementation copied and then locally edited — 385 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 (42 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (42 matched lines × 2 locations) apps/web/features/reader/v3/original-publication/mobi-worker-client.ts:10 — apps/web/features/reader/v3/original-publication/mobi-worker-client.ts:10 · apps/web/features/reader/v3/original-publication/text-worker-client.ts:10 — the two spans are one implementation copied and then locally edited — 339 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 (35 lines × 2 locations) · ×1
  • Duplicated block (35 lines × 2 locations) apps/web/scripts/migrate-i18n-jsx-attributes.mjs:14 — apps/web/scripts/migrate-i18n-jsx-attributes.mjs:14 · apps/web/scripts/migrate-i18n-jsx-expressions.mjs:20 — 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 with local edits (34 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (34 matched lines × 2 locations) apps/web/features/library/async-filter-value-editor.tsx:27 — apps/web/features/library/async-filter-value-editor.tsx:27 · apps/web/features/library/ui/library-tag-input.tsx:29 — the two spans are one implementation copied and then locally edited — 222 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 (21 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (21 matched lines × 2 locations) apps/web/lib/pwa/frontend-resource-update.ts:43 — apps/web/lib/pwa/frontend-resource-update.ts:43 · apps/web/lib/pwa/frontend-resource-update.ts:136 — the two spans are one implementation copied and then locally edited — 147 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) apps/web/features/kindle/kindle-send-queue-page.tsx:127 — apps/web/features/kindle/kindle-send-queue-page.tsx:127 · apps/web/features/organize/organize-page.tsx:259 — 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 (18 lines × 2 locations) · ×1
  • Duplicated block (18 lines × 2 locations) apps/web/components/layout/app-shell.tsx:395 — apps/web/components/layout/app-shell.tsx:395 · apps/web/features/reader/v3/use-reader-pwa-surface.ts:19 — 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.
R10 · Code Duplication · Duplicated block (18 lines × 3 locations) · ×1
  • Duplicated block (18 lines × 3 locations) apps/web/components/ui/combobox.tsx:74 — apps/web/components/ui/combobox.tsx:74 · apps/web/components/ui/multi-value-combobox.tsx:157 · apps/web/components/ui/select.tsx:136 — the 3 copies are spread across 3 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 (16 lines × 3 locations) · ×1
  • Duplicated block (16 lines × 3 locations) apps/web/features/library/api/bulk-operations.ts:37 — apps/web/features/library/api/bulk-operations.ts:37 · apps/web/features/management/api/events.ts:22 · apps/web/features/organize/api/facets.ts:18 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (15 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (15 matched lines × 2 locations) apps/web/features/dashboard/dashboard-page.tsx:84 — apps/web/features/dashboard/dashboard-page.tsx:84 · apps/web/features/library/library-page.tsx:506 — the two spans are one implementation copied and then locally edited — 64 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (13 lines × 3 locations) · ×1
  • Duplicated block (13 lines × 3 locations) apps/web/features/audio/api.ts:14 — apps/web/features/audio/api.ts:14 · apps/web/features/books/api/client.ts:17 · apps/web/features/reader/v3/api.ts:103 — the 3 copies are spread across 3 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. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication · Duplicated block with local edits (13 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (13 matched lines × 2 locations) apps/web/features/reader/v3/original-publication/chapter-core.ts:337 — apps/web/features/reader/v3/original-publication/chapter-core.ts:337 · apps/web/features/reader/v3/original-publication/chapter-core.ts:378 — the two spans are one implementation copied and then locally edited — 128 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.
R2 · Cyclomatic Complexity · Complex function ShelvesPage (cyclomatic 146, cognitive 128) · ×1
  • Complex function ShelvesPage (cyclomatic 146, cognitive 128) apps/web/features/shelves/shelves-page.tsx:76 — ShelvesPage has cyclomatic complexity 146 and cognitive complexity 128; 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 ReaderShell (cyclomatic 130, cognitive 126) · ×1
  • Complex function ReaderShell (cyclomatic 130, cognitive 126) apps/web/features/reader/reader-shell.tsx:250 — ReaderShell has cyclomatic complexity 130 and cognitive complexity 126; 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 UpdateOperations (cyclomatic 93, cognitive 79) · ×1
  • Complex function UpdateOperations (cyclomatic 93, cognitive 79) apps/web/features/updates/ui/update-operations.tsx:40 — UpdateOperations has cyclomatic complexity 93 and cognitive complexity 79; 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 BookDetailPage (cyclomatic 81, cognitive 73) · ×1
  • Complex function BookDetailPage (cyclomatic 81, cognitive 73) apps/web/features/books/book-detail-page.tsx:189 — BookDetailPage has cyclomatic complexity 81 and cognitive complexity 73; 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 evaluateFactCase (cyclomatic 71, cognitive 38) · ×1
  • Complex function evaluateFactCase (cyclomatic 71, cognitive 38) REDACTED:563 — evaluateFactCase has cyclomatic complexity 71 and cognitive complexity 38; 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 readerErrorMessage (cyclomatic 68, cognitive 67) · ×1
  • Complex function readerErrorMessage (cyclomatic 68, cognitive 67) apps/web/features/reader/v3/reader-engine-runtime.tsx:76 — readerErrorMessage has cyclomatic complexity 68 and cognitive complexity 67; 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 AudioMiniPlayer (cyclomatic 62, cognitive 64) · ×1
  • Complex function AudioMiniPlayer (cyclomatic 62, cognitive 64) apps/web/components/audio/audio-mini-player.tsx:42 — AudioMiniPlayer has cyclomatic complexity 62 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function LibraryPage (cyclomatic 56, cognitive 54) · ×1
  • Complex function LibraryPage (cyclomatic 56, cognitive 54) apps/web/features/library/library-page.tsx:75 — LibraryPage has cyclomatic complexity 56 and cognitive complexity 54; 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 fetchReaderBootstrap (cyclomatic 55, cognitive 51) · ×1
  • Complex function fetchReaderBootstrap (cyclomatic 55, cognitive 51) apps/web/features/reader/v3/api.ts:255 — fetchReaderBootstrap has cyclomatic complexity 55 and cognitive complexity 51; 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 LibraryBatchDialog (cyclomatic 51, cognitive 47) · ×1
  • Complex function LibraryBatchDialog (cyclomatic 51, cognitive 47) apps/web/features/library/library-batch-actions.tsx:144 — LibraryBatchDialog has cyclomatic complexity 51 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 execute (cyclomatic 44, cognitive 62) · ×1
  • Complex function execute (cyclomatic 44, cognitive 62) apps/web/features/reader/v3/adapters/pdf-adapter.ts:367 — execute has cyclomatic complexity 44 and cognitive complexity 62; 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 ResourceDetailView (cyclomatic 44, cognitive 42) · ×1
  • Complex function ResourceDetailView (cyclomatic 44, cognitive 42) apps/web/features/books/ui/resource-detail-view.tsx:75 — ResourceDetailView has cyclomatic complexity 44 and cognitive complexity 42; 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 renderPage (cyclomatic 40, cognitive 37) · ×1
  • Complex function renderPage (cyclomatic 40, cognitive 37) apps/web/features/reader/v3/adapters/pdf-adapter.ts:692 — renderPage has cyclomatic complexity 40 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 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 AppShell (cyclomatic 39, cognitive 35) · ×1
  • Complex function AppShell (cyclomatic 39, cognitive 35) apps/web/components/layout/app-shell.tsx:143 — AppShell has cyclomatic complexity 39 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 openEpub (cyclomatic 38, cognitive 63) · ×1
  • Complex function openEpub (cyclomatic 38, cognitive 63) apps/web/features/reader/v3/adapters/readium-publication.ts:310 — openEpub has cyclomatic complexity 38 and cognitive complexity 63; 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 normalizeAudioBootstrap (cyclomatic 38, cognitive 35) · ×1
  • Complex function normalizeAudioBootstrap (cyclomatic 38, cognitive 35) apps/web/features/audio/api.ts:103 — normalizeAudioBootstrap has cyclomatic complexity 38 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 execute (cyclomatic 37, cognitive 48) · ×1
  • Complex function execute (cyclomatic 37, cognitive 48) apps/web/features/reader/v3/adapters/comic-adapter.ts:317 — execute has cyclomatic complexity 37 and cognitive complexity 48; 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 (anonymous) (cyclomatic 36, cognitive 40) · ×1
  • Complex function (anonymous) (cyclomatic 36, cognitive 40) prototypes/feedback-web/prototype.js:335 — (anonymous) has cyclomatic complexity 36 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function execute (cyclomatic 33, cognitive 48) · ×1
  • Complex function execute (cyclomatic 33, cognitive 48) apps/web/features/reader/v3/adapters/readium-adapter.ts:549 — execute has cyclomatic complexity 33 and cognitive complexity 48; 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 openElement (cyclomatic 33, cognitive 41) · ×1
  • Complex function openElement (cyclomatic 33, cognitive 41) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:305 — openElement has cyclomatic complexity 33 and cognitive complexity 41; 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 validateReleaseAssets (cyclomatic 33, cognitive 38) · ×1
  • Complex function validateReleaseAssets (cyclomatic 33, cognitive 38) scripts/validate-release-assets.mjs:9 — validateReleaseAssets has cyclomatic complexity 33 and cognitive complexity 38; 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 (anonymous) (cyclomatic 31, cognitive 38) · ×1
  • Complex function (anonymous) (cyclomatic 31, cognitive 38) apps/web/e2e/release-live.spec.ts:657 — (anonymous) has cyclomatic complexity 31 and cognitive complexity 38; 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 materializeFb2Chapter (cyclomatic 30, cognitive 51) · ×1
  • Complex function materializeFb2Chapter (cyclomatic 30, cognitive 51) apps/web/features/reader/v3/original-publication/text-publication.worker.ts:108 — materializeFb2Chapter has cyclomatic complexity 30 and cognitive complexity 51; 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 validateRequest (cyclomatic 30, cognitive 28) · ×1
  • Complex function validateRequest (cyclomatic 30, cognitive 28) REDACTED:29 — validateRequest has cyclomatic complexity 30 and cognitive complexity 28; 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 readerSessionReducer (cyclomatic 29, cognitive 27) · ×1
  • Complex function readerSessionReducer (cyclomatic 29, cognitive 27) packages/reader-core/src/session.ts:96 — readerSessionReducer has cyclomatic complexity 29 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 BookContentBrowser (cyclomatic 29, cognitive 23) · ×1
  • Complex function BookContentBrowser (cyclomatic 29, cognitive 23) apps/web/features/books/ui/book-content-browser.tsx:75 — BookContentBrowser has cyclomatic complexity 29 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 invoke (cyclomatic 27, cognitive 38) · ×1
  • Complex function invoke (cyclomatic 27, cognitive 38) apps/web/features/books/ui/book-action-controller.tsx:109 — invoke has cyclomatic complexity 27 and cognitive complexity 38; 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 (anonymous) (cyclomatic 27, cognitive 29) · ×1
  • Complex function (anonymous) (cyclomatic 27, cognitive 29) apps/web/features/audio/audio-playback-provider.tsx:400 — (anonymous) has cyclomatic complexity 27 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function namespacesForElement (cyclomatic 25, cognitive 37) · ×1
  • Complex function namespacesForElement (cyclomatic 25, cognitive 37) apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:180 — namespacesForElement 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 (anonymous) (cyclomatic 25, cognitive 33) · ×1
  • Complex function (anonymous) (cyclomatic 25, cognitive 33) apps/web/e2e/automation-settings.spec.ts:27 — (anonymous) has cyclomatic complexity 25 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function startFixture (cyclomatic 25, cognitive 32) · ×1
  • Complex function startFixture (cyclomatic 25, cognitive 32) apps/web/e2e/release-live.spec.ts:216 — startFixture has cyclomatic complexity 25 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function TargetDirectoryPicker (cyclomatic 25, cognitive 24) · ×1
  • Complex function TargetDirectoryPicker (cyclomatic 25, cognitive 24) apps/web/components/directory/target-directory-picker.tsx:57 — TargetDirectoryPicker 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 DirectoryPathPicker (cyclomatic 25, cognitive 23) · ×1
  • Complex function DirectoryPathPicker (cyclomatic 25, cognitive 23) apps/web/features/settings/ui/directory-path-picker.tsx:13 — DirectoryPathPicker has cyclomatic complexity 25 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 MetadataLookupModal (cyclomatic 25, cognitive 21) · ×1
  • Complex function MetadataLookupModal (cyclomatic 25, cognitive 21) apps/web/features/books/metadata-lookup-modal.tsx:92 — MetadataLookupModal has cyclomatic complexity 25 and cognitive complexity 21; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function ReaderEngineRuntime (cyclomatic 25, cognitive 18) · ×1
  • Complex function ReaderEngineRuntime (cyclomatic 25, cognitive 18) apps/web/features/reader/v3/reader-engine-runtime.tsx:156 — ReaderEngineRuntime has cyclomatic complexity 25 and cognitive complexity 18; 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 dependencyAssets (cyclomatic 25, cognitive 12) · ×1
  • Complex function dependencyAssets (cyclomatic 25, cognitive 12) scripts/validate-app-packages.mjs:55 — dependencyAssets has cyclomatic complexity 25 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function translateDomNode (cyclomatic 24, cognitive 50) · ×1
  • Complex function translateDomNode (cyclomatic 24, cognitive 50) apps/web/i18n/provider.tsx:70 — translateDomNode has cyclomatic complexity 24 and cognitive complexity 50; 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 (anonymous) (cyclomatic 24, cognitive 33) · ×1
  • Complex function (anonymous) (cyclomatic 24, cognitive 33) apps/web/features/audio/audio-playback-provider.tsx:337 — (anonymous) has cyclomatic complexity 24 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 24, cognitive 28) · ×1
  • Complex function (anonymous) (cyclomatic 24, cognitive 28) apps/web/e2e/release-live.spec.ts:903 — (anonymous) has cyclomatic complexity 24 and cognitive complexity 28; 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 typeExpression (cyclomatic 24, cognitive 26) · ×1
  • Complex function typeExpression (cyclomatic 24, cognitive 26) apps/web/scripts/generate-reader-api.mjs:48 — typeExpression has cyclomatic complexity 24 and cognitive complexity 26; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · apps/web/features/reader/reader-shell.tsx · ×1
  • apps/web/features/reader/reader-shell.tsx: 1454 lines of code apps/web/features/reader/reader-shell.tsx:1 — apps/web/features/reader/reader-shell.tsx has 1454 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 · apps/web/features/audio/audio-playback-provider.tsx · ×1
  • apps/web/features/audio/audio-playback-provider.tsx: 1088 lines of code apps/web/features/audio/audio-playback-provider.tsx:1 — apps/web/features/audio/audio-playback-provider.tsx has 1088 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 · apps/web/components/layout/app-shell.tsx · ×1
  • apps/web/components/layout/app-shell.tsx: 1059 lines of code apps/web/components/layout/app-shell.tsx:1 — apps/web/components/layout/app-shell.tsx has 1059 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 · apps/web/features/shelves/shelves-page.tsx · ×1
  • apps/web/features/shelves/shelves-page.tsx: 1047 lines of code apps/web/features/shelves/shelves-page.tsx:1 — apps/web/features/shelves/shelves-page.tsx has 1047 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 · apps/web/features/reader/v3/adapters/pdf-adapter.ts · ×1
  • apps/web/features/reader/v3/adapters/pdf-adapter.ts: 1044 lines of code apps/web/features/reader/v3/adapters/pdf-adapter.ts:1 — apps/web/features/reader/v3/adapters/pdf-adapter.ts has 1044 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 · REDACTED · ×1
  • REDACTED: 872 lines of code REDACTED:1 — REDACTED has 872 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 · apps/web/features/reader/v3/adapters/readium-adapter.ts · ×1
  • apps/web/features/reader/v3/adapters/readium-adapter.ts: 839 lines of code apps/web/features/reader/v3/adapters/readium-adapter.ts:1 — apps/web/features/reader/v3/adapters/readium-adapter.ts has 839 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 · apps/web/features/reader/v3/security/reader-safety-policy.ts · ×1
  • apps/web/features/reader/v3/security/reader-safety-policy.ts: 784 lines of code apps/web/features/reader/v3/security/reader-safety-policy.ts:1 — apps/web/features/reader/v3/security/reader-safety-policy.ts has 784 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 · apps/web/features/reader/v3/adapters/comic-adapter.ts · ×1
  • apps/web/features/reader/v3/adapters/comic-adapter.ts: 758 lines of code apps/web/features/reader/v3/adapters/comic-adapter.ts:1 — apps/web/features/reader/v3/adapters/comic-adapter.ts has 758 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 · apps/web/features/books/book-detail-page.tsx · ×1
  • apps/web/features/books/book-detail-page.tsx: 753 lines of code apps/web/features/books/book-detail-page.tsx:1 — apps/web/features/books/book-detail-page.tsx has 753 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 · apps/web/features/books/api/client.ts · ×1
  • apps/web/features/books/api/client.ts: 700 lines of code apps/web/features/books/api/client.ts:1 — apps/web/features/books/api/client.ts has 700 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · apps/web/features/library/library-page.tsx · ×1
  • apps/web/features/library/library-page.tsx: 682 lines of code apps/web/features/library/library-page.tsx:1 — apps/web/features/library/library-page.tsx has 682 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 · apps/web/features/settings/settings-page.tsx · ×1
  • apps/web/features/settings/settings-page.tsx: 631 lines of code apps/web/features/settings/settings-page.tsx:1 — apps/web/features/settings/settings-page.tsx has 631 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 · apps/web/features/reader/v3/reader-engine-runtime.tsx · ×1
  • apps/web/features/reader/v3/reader-engine-runtime.tsx: 629 lines of code apps/web/features/reader/v3/reader-engine-runtime.tsx:1 — apps/web/features/reader/v3/reader-engine-runtime.tsx has 629 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 · apps/web/features/reader/v3/adapters/readium-publication.ts · ×1
  • apps/web/features/reader/v3/adapters/readium-publication.ts: 581 lines of code apps/web/features/reader/v3/adapters/readium-publication.ts:1 — apps/web/features/reader/v3/adapters/readium-publication.ts has 581 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 · apps/web/components/system/pwa-client.tsx · ×1
  • apps/web/components/system/pwa-client.tsx: 580 lines of code apps/web/components/system/pwa-client.tsx:1 — apps/web/components/system/pwa-client.tsx has 580 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 · apps/web/features/reader/v3/reader-v3-page.tsx · ×1
  • apps/web/features/reader/v3/reader-v3-page.tsx: 579 lines of code apps/web/features/reader/v3/reader-v3-page.tsx:1 — apps/web/features/reader/v3/reader-v3-page.tsx 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 · apps/web/features/library/library-batch-actions.tsx · ×1
  • apps/web/features/library/library-batch-actions.tsx: 555 lines of code apps/web/features/library/library-batch-actions.tsx:1 — apps/web/features/library/library-batch-actions.tsx has 555 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 · apps/web/features/reader/v3/paged-track/paged-track-controller.ts · ×1
  • apps/web/features/reader/v3/paged-track/paged-track-controller.ts: 541 lines of code apps/web/features/reader/v3/paged-track/paged-track-controller.ts:1 — apps/web/features/reader/v3/paged-track/paged-track-controller.ts has 541 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 · apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts · ×1
  • apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts: 497 lines of code apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts:1 — apps/web/features/reader/v3/original-publication/strict-fb2-parser.ts has 497 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 · apps/web/features/books/metadata-lookup-modal.tsx · ×1
  • apps/web/features/books/metadata-lookup-modal.tsx: 447 lines of code apps/web/features/books/metadata-lookup-modal.tsx:1 — apps/web/features/books/metadata-lookup-modal.tsx has 447 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · apps/web/features/settings/center/users-permissions-page.tsx · ×1
  • apps/web/features/settings/center/users-permissions-page.tsx: 446 lines of code apps/web/features/settings/center/users-permissions-page.tsx:1 — apps/web/features/settings/center/users-permissions-page.tsx has 446 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 · apps/web/lib/reader/v5-sync-coordinator.ts · ×1
  • apps/web/lib/reader/v5-sync-coordinator.ts: 445 lines of code apps/web/lib/reader/v5-sync-coordinator.ts:1 — apps/web/lib/reader/v5-sync-coordinator.ts has 445 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 · apps/web/features/reader/v3/api.ts · ×1
  • apps/web/features/reader/v3/api.ts: 433 lines of code apps/web/features/reader/v3/api.ts:1 — apps/web/features/reader/v3/api.ts has 433 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 · apps/readium-web-poc/src/main.ts · ×1
  • apps/readium-web-poc/src/main.ts: 432 lines of code apps/readium-web-poc/src/main.ts:1 — apps/readium-web-poc/src/main.ts has 432 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 · apps/web/components/audio/audio-mini-player.tsx · ×1
  • apps/web/components/audio/audio-mini-player.tsx: 427 lines of code apps/web/components/audio/audio-mini-player.tsx:1 — apps/web/components/audio/audio-mini-player.tsx has 427 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 · apps/web/features/reader/v3/adapters/comic-track.ts · ×1
  • apps/web/features/reader/v3/adapters/comic-track.ts: 414 lines of code apps/web/features/reader/v3/adapters/comic-track.ts:1 — apps/web/features/reader/v3/adapters/comic-track.ts has 414 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 · apps/web/features/organize/organize-page.tsx · ×1
  • apps/web/features/organize/organize-page.tsx: 412 lines of code apps/web/features/organize/organize-page.tsx:1 — apps/web/features/organize/organize-page.tsx has 412 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 (~417 LoC) · ×1
  • Dead file (~417 LoC) prototypes/feedback-web/prototype.js — no import path from any entry point (101 application, 22 tooling, 171 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~98 LoC) · ×1
  • Dead file (~98 LoC) apps/web/features/books/application/use-resource-wall-selection.ts — no import path from any entry point (101 application, 22 tooling, 171 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~89 LoC) · ×1
  • Dead file (~89 LoC) apps/web/components/book/book-card.tsx — no import path from any entry point (101 application, 22 tooling, 171 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~36 LoC) · ×1
  • Dead file (~36 LoC) apps/web/features/reader/v3/adapters/readium-resource-identity.ts — no import path from any entry point (101 application, 22 tooling, 171 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~26 LoC) · ×1
  • Dead file (~26 LoC) prototypes/feedback-web/generate-icons.mjs — no import path from any entry point (101 application, 22 tooling, 171 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
X24 · Document value interpolated into markup unescaped · Document value reaches a markup attribute unescaped · ×1
  • Document value reaches a markup attribute unescaped REDACTED:209 — `value` 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 `value` at this site, or validate it against the shape the position accepts before interpolating it.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×1
  • Untrusted text written into markup unescaped apps/web/app/layout.tsx:80 — `basePathFetchBridge` is text this program did not author, and it is written into the text of an element through `dangerouslySetInnerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Minor — 114 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate apps/web/features/reader/reader-shell.tsx:627 — `!event.shiftKey && document.activeElement === last` appears character-identically in 2 files — apps/web/features/reader/reader-shell.tsx, apps/web/features/reader/v3/reader-engine-runtime.tsx. 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 apps/web/features/settings/api/import-preferences-client.ts:16 — `!isRecord(payload) || !isRecord(payload.error) || typeof payload.error.message !== 'string'` appears character-identically in 3 files — apps/web/features/settings/api/import-preferences-client.ts, apps/web/features/settings/api/library-scan-settings-client.ts, apps/web/features/settings/api/opds-settings-client.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 apps/web/features/settings/api/library-scan-settings-client.ts:16 — `!isRecord(payload) || payload.ok !== true || !isRecord(payload.data)` appears character-identically in 2 files — apps/web/features/settings/api/library-scan-settings-client.ts, apps/web/features/settings/api/opds-settings-client.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 apps/web/features/reader/v3/original-publication/chapter-core.ts:83 — `!manifestResponse.ok || manifest.schemaVersion !== 1 || manifest.abiVersion !== ABI_VERSION || manifest.emscriptenVersion !== '3.1.74'` appears character-identically in 2 files — apps/web/features/reader/v3/original-publication/chapter-core.ts, apps/web/features/reader/v3/original-publication/mobi-core.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 apps/web/components/directory/target-directory-picker.tsx:327 — `!node.readable && !(node.mountedOnly && node.path === '/')` appears character-identically in 2 files — apps/web/components/directory/target-directory-picker.tsx, apps/web/features/settings/ui/directory-path-picker.tsx. 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 apps/web/features/dashboard/api/dashboard.ts:36 — `!response.ok || !isObject(payload) || payload.ok !== true || !('data' in payload)` appears character-identically in 5 files — apps/web/features/dashboard/api/dashboard.ts, apps/web/features/library/api/bulk-operations.ts, apps/web/features/management/api/events.ts, apps/web/features/management/api/overview.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 apps/web/components/ui/combobox.tsx:70 — `!rootRef.current?.contains(target) && !menuRef.current?.contains(target)` appears character-identically in 2 files — apps/web/components/ui/combobox.tsx, apps/web/components/ui/select.tsx. 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 apps/web/features/updates/api/operations.ts:5 — `!value || typeof value !== 'object' || Array.isArray(value)` appears character-identically in 2 files — apps/web/features/updates/api/operations.ts, apps/web/features/updates/model/release-notes.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 apps/web/scripts/migrate-i18n-jsx-attributes.mjs:41 — `(ts.isArrowFunction(current) || ts.isFunctionExpression(current)) && ts.isBlock(current.body)` appears character-identically in 2 files — apps/web/scripts/migrate-i18n-jsx-attributes.mjs, apps/web/scripts/migrate-i18n-jsx-expressions.mjs. 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 apps/web/components/ui/combobox.tsx:91 — `availableBelow < Math.min(desiredHeight, 176) && availableAbove > availableBelow` appears character-identically in 3 files — apps/web/components/ui/combobox.tsx, apps/web/components/ui/multi-value-combobox.tsx, apps/web/components/ui/select.tsx. 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 apps/web/features/reader/v3/adapters/readium-publication.ts:469 — `cause instanceof ReaderSafetyPolicyError && cause.action === 'BLOCK_RESOURCE'` appears character-identically in 2 files — apps/web/features/reader/v3/adapters/readium-publication.ts, apps/web/features/reader/v3/original-publication/mobi-publication.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:88 — `child.exitCode !== null || child.signalCode !== null` appears character-identically in 2 files — REDACTED, scripts/python-worker-runtime-smoke.mjs. 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:127 — `child.exitCode === null && child.signalCode === null` appears character-identically in 2 files — REDACTED, scripts/python-worker-runtime-smoke.mjs. 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 apps/web/lib/base-path.ts:3 — `configuredBasePath && configuredBasePath !== '/'` appears character-identically in 2 files — apps/web/lib/base-path.ts, apps/web/next.config.js. 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 apps/web/features/reader/api/client.ts:104 — `data.schemaVersion !== 5 || !Object.prototype.hasOwnProperty.call(data, 'progressSnapshot')` appears character-identically in 2 files — apps/web/features/reader/api/client.ts, apps/web/features/reader/v3/api.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 apps/web/scripts/build-chapters-wasm.mjs:40 — `entry.isDirectory() && !entry.name.startsWith('build') && !entry.name.startsWith('.')` appears character-identically in 2 files — apps/web/scripts/build-chapters-wasm.mjs, apps/web/scripts/verify-chapters-wasm.mjs. 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 apps/web/scripts/build-chapters-wasm.mjs:41 — `entry.isFile() && /(?:\.c|\.h|\.cmake|CMakeLists\.txt)$/.test(entry.name)` appears character-identically in 2 files — apps/web/scripts/build-chapters-wasm.mjs, apps/web/scripts/verify-chapters-wasm.mjs. 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 apps/web/scripts/build-mobi-wasm.mjs:29 — `entry.isFile() && /\.(?:c|h|cmake|txt)$/.test(entry.name)` appears character-identically in 2 files — apps/web/scripts/build-mobi-wasm.mjs, apps/web/scripts/verify-mobi-wasm.mjs. 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 apps/web/features/settings/center/settings-secondary-nav.tsx:90 — `event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey` appears character-identically in 2 files — apps/web/features/settings/center/settings-secondary-nav.tsx, apps/web/features/settings/center/settings-tabs.tsx. 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 apps/web/components/ui/combobox.tsx:115 — `event.key === 'ArrowDown' || event.key === 'ArrowUp'` appears character-identically in 3 files — apps/web/components/ui/combobox.tsx, apps/web/components/ui/multi-value-combobox.tsx, apps/web/components/ui/select.tsx. 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 apps/web/features/reader/reader-shell.tsx:624 — `event.shiftKey && document.activeElement === first` appears character-identically in 2 files — apps/web/features/reader/reader-shell.tsx, apps/web/features/reader/v3/reader-engine-runtime.tsx. 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 apps/web/scripts/migrate-i18n-jsx-attributes.mjs:23 — `extname(entry.name) === '.tsx' && !entry.name.includes('.test.') && !entry.name.includes('.spec.')` appears character-identically in 3 files — apps/web/scripts/migrate-i18n-jsx-attributes.mjs, apps/web/scripts/migrate-i18n-jsx-expressions.mjs, apps/web/scripts/migrate-i18n-jsx-text.mjs. 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 apps/readium-web-poc/src/main.ts:229 — `image.complete && image.naturalWidth > 0` appears character-identically in 2 files — apps/readium-web-poc/src/main.ts, apps/web/features/reader/v3/adapters/comic-track.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 apps/web/features/reader/v3/adapters/comic-adapter.ts:297 — `isAbortError(reason) || reason instanceof StaleReaderOperationError` appears character-identically in 2 files — apps/web/features/reader/v3/adapters/comic-adapter.ts, apps/web/features/reader/v3/adapters/pdf-adapter.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 apps/web/features/dashboard/api/dashboard.ts:37 — `isObject(payload) && isObject(payload.error) && typeof payload.error.message === 'string'` appears character-identically in 6 files — apps/web/features/dashboard/api/dashboard.ts, apps/web/features/library/api/bulk-operations.ts, apps/web/features/library/api/filtering.ts, apps/web/features/management/api/events.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.
  • + 15 more in this group — see findings.md.
AX6 · Interface segregation · Fat interface · ×8
  • Fat interface: ReaderV5Storage (16 required operations) apps/web/lib/reader/v5-storage.ts:229 — `ReaderV5Storage` declares 16 required operations: `getClientId`, `getV5Progress`, `putV5Progress`, `putV5ExactAndPending`, `putV5PendingProgress`, `getV5PendingProgress`, `getV5PendingProgressForIdentity`, `listV5PendingProgress`, `deleteV5PendingProgress`, `putV5ExactAndDeletePending`, `getPreference`, `putPreference`, `deletePreference`, `addDiagnostic`, `listDiagnostics`, `clearAll`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: AdministrativeSettingsRepository (77 abstract methods) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/administrativesettings/application/AdministrativeSettingsRepository.kt:62 — `AdministrativeSettingsRepository` declares 77 abstract methods: `invalidatePendingResponses`, `loadKindleSettings`, `updateKindleEmail`, `listKindleTasks`, `createKindleTask`, `cancelKindleTask`, `retryKindleTask`, `deleteKindleTask`, `loadEmailSettings`, `updateEmailSettings`, `testSmtp`, `listUsers`, `loadUser`, `createUser`, `updateUser`, `setUserStatus`, `resetUserPassword`, `deleteUser`, `loadLibraries`, `createLibrary`, `updateLibrary`, `deleteLibrary`, `loadDirectory`, `loadLibraryScanSettings`, `updateLibraryScanSettings`, `listImportTasks`, `loadImportTask`, `listImportTaskLogs`, `retryImportTask`, `deleteImportTask`, `clearCompletedImportTasks`, `clearImportQueue`, `rescanImportFolders`, `scanDirectory`, `listImportScanJobs`, `loadImportScanJob`, `cancelImportScanJob`, `loadImportPreferences`, `updateImportPreferences`, `listOrganizeJobs`, and 37 more. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: MobileRuntime (16 abstract methods) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/public.kt:17 — `MobileRuntime` declares 16 abstract methods: `observeSession`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTls`, `retry`, `login`, `loginToServer`, `loginToServerAcceptingInsecureTls`, `setupInitialAdmin`, `refreshCurrentSession`, `logout`, `close`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: MobileRuntimeBridge (16 abstract methods) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/auth/public.kt:128 — `MobileRuntimeBridge` declares 16 abstract methods: `observeSession`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTls`, `retry`, `login`, `loginToServer`, `loginToServerAcceptingInsecureTls`, `setupInitialAdmin`, `refreshCurrentSession`, `logout`, `close`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: WorkManagementRepository (20 abstract methods) apps/mobile/shared/src/commonMain/kotlin/com/ermao/library/shared/modules/workmanagement/application/WorkManagementRepository.kt:26 — `WorkManagementRepository` declares 20 abstract methods: `loadBookMenuContext`, `saveBookFields`, `replaceBookTags`, `loadManagementSnapshot`, `saveResourceFields`, `saveSourcePresentation`, `regenerateBookImage`, `deleteResourceSource`, `applyRecognizedFields`, `applyDirectoryMetadata`, `uploadCover`, `regenerateResourceCover`, `rescanBook`, `deleteBook`, `loadMetadataProviders`, `searchMetadata`, `loadKindleSettings`, `sendToKindle`, `setReadingStatus`, `setBookReadingStatus`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: BookResourceRepositoryPort (37 protocol members) apps/api-python/app/modules/library/application/source_tree_ports.py:262 — `BookResourceRepositoryPort` declares 37 protocol members: `refresh_scan_context`, `page_directory_members`, `directory_failure_summary`, `page_ready_directory_cover_candidates`, `save_directory_assets`, `resource_cover_state`, `single_file_fallback_cover`, `resource_local_observations`, `ensure_book`, `get_book_id_for_source_node`, `get_resource_by_source_node`, `get_resource`, `page_book_resources`, `resource_matches_owner`, `create_pending_resource`, `refresh_resource_adapter`, `delete_resource`, `invalidate_asset_for_reimport`, `set_enablement`, `mark_resource_ready`, `set_resource_page_count`, `should_extract_first_page_cover`, `save_asset_local_metadata`, `refresh_resource_local_metadata`, `apply_local_metadata`, `clear_local_cover`, `mark_resource_failed`, `upsert_asset`, `asset_has_processed_version`, `asset_was_imported`, `count_ready_assets`, `refresh_audio_resource_aggregates`, `replace_navigation_units`, `find_outermost_directory_resource`, `delete_library_overlay_rows`, `delete_assets_for_source_nodes`, `reevaluate_ready_after_asset_loss`. Counted over its public methods and properties, once per name — a `typing.Protocol` is satisfied structurally, so every one of them is an operation each implementer must provide and each consumer depends on; `_`-prefixed members, static methods and data attributes are not counted, and an `@overload` family is one operation. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: MobileRuntimeClient (16 requirements) apps/mobile/iosApp/ErmaoLibrary/Application/MobileRuntimeClient.swift:157 — `MobileRuntimeClient` declares 16 requirements: `observe`, `start`, `connectServer`, `editServer`, `switchServer`, `removeServer`, `restoreSystemTrust`, `acceptInsecureTLS`, `loginToServer`, `loginToServerAcceptingInsecureTLS`, `login`, `setup`, `retry`, `refreshCurrentSession`, `logout`, `close`. Counted over its method requirements (members with no body), once per name; a default supplied by a protocol extension is not counted, because no conformer is forced to write it. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: AdministrativeSettingsClient (75 requirements) apps/mobile/iosApp/ErmaoLibrary/Features/AdministrativeSettings/AdministrativeSettingsClient.swift:3 — `AdministrativeSettingsClient` declares 75 requirements: `invalidatePendingResponses`, `loadManagementSummary`, `loadEmailAndKindle`, `saveKindle`, `saveSMTP`, `sendSMTPTest`, `loadKindleTasks`, `cancelKindleTask`, `retryKindleTask`, `deleteKindleTask`, `loadUsers`, `loadUser`, `createUser`, `updateUser`, `setUserEnabled`, `deleteUser`, `resetUserPassword`, `loadUserEditor`, `loadLibrarySources`, `loadLibrarySource`, `createLibrarySource`, `updateLibrarySource`, `deleteLibrarySource`, `rescanLibrarySource`, `loadServerDirectories`, `scanDirectory`, `cancelDirectoryScan`, `loadImportTasks`, `loadImportTaskDetail`, `retryImportTask`, `deleteImportTask`, `clearCompletedImportTasks`, `rescanAllLibrarySources`, `loadImportScans`, `cancelImportScan`, `loadImportPreferences`, `saveImportPreferences`, `loadLibraryScanSettings`, `saveLibraryScanSettings`, `loadOrganizeJobs`, and 35 more. Counted over its method requirements (members with no body), once per name; a default supplied by a protocol extension is not counted, because no conformer is forced to write it. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D29 · Static Analysis (SAST) · REDACTED · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×5
  • Projects may be oversized for their cohesion apps/api-python/pyproject.toml:1 — `apps/api-python` (108724 LoC, 2071 module-visible types across 81 directories) overshoots its size bounds. 5 of 19 build unit(s) (Gradle, Python, SwiftPM, Xcode, npm) overshoot their size bounds, lowering Project Cohesion to 4.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion apps/mobile/shared/build.gradle.kts:1 — `apps/mobile/shared` (22091 LoC, 1723 module-visible types across 59 directories) overshoots its size bounds. 5 of 19 build unit(s) (Gradle, Python, SwiftPM, Xcode, npm) overshoot their size bounds, lowering Project Cohesion to 4.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion REDACTED:1 — `apps/web` (43586 LoC, 400 module-visible types across 100 directories) overshoots its size bounds. 5 of 19 build unit(s) (Gradle, Python, SwiftPM, Xcode, npm) overshoot their size bounds, lowering Project Cohesion to 4.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion apps/mobile/androidApp/build.gradle.kts:1 — `apps/mobile/androidApp` (40524 LoC, 1176 module-visible types across 42 directories) overshoots its size bounds. 5 of 19 build unit(s) (Gradle, Python, SwiftPM, Xcode, npm) overshoot their size bounds, lowering Project Cohesion to 4.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion apps/mobile/iosApp/ErmaoLibrary.xcodeproj/project.pbxproj:1 — `apps/mobile/iosApp` (37702 LoC, 581 module-visible types across 17 directories) overshoots its size bounds. 5 of 19 build unit(s) (Gradle, Python, SwiftPM, Xcode, npm) overshoot their size bounds, lowering Project Cohesion to 4.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
X7 · Silent fallback defaults · Silent fallback default in catch · ×5
  • Silent fallback default in catch apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/reader/infrastructure/AndroidReaderBookmarkCoordinator.kt:131 — `commitBookmarkMutation` swallows every exception into `0.0` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
  • Silent fallback default in catch apps/web/lib/audio-device-preferences.ts:28 — `readAudioDevicePreferences` 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 apps/web/features/books/book-detail.ts:12 — `bookDetailReturnHref` swallows every exception into `return '/library'` — 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 apps/web/features/reader/v3/bookmarks.ts:35 — `readReaderBookmarks` 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 apps/web/features/reader/v3/adapters/readium-resource-identity.ts:6 — `normalizedPath` 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.
D31 · IaC & Container Security · Low IaC · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×4
  • Hand-rolled JSON/XML parsing via regex REDACTED:408 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:425 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:447 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
  • Hand-rolled JSON/XML parsing via regex REDACTED:452 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Python code already uses a real parser in the same package; use it here too.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found REDACTED:7 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `REDACTED` makes this repository a deployable product (line 7).
D21 · Naming Consistency · `DownloadTaskDTO` spells `DTO` where 36 names in the project spell it `Dto` · ×1
  • `DownloadTaskDTO` spells `DTO` where 36 names in the project spell it `Dto` apps/api-python/app/modules/download/application/dto.py:8 — 36 of 37 names in project ermao-books-api-python spell the token `Dto` (36 of 37; unit: names in project ermao-books-api-python containing `Dto`). Peers: apps.api-python.app.modules.opds.application.dto.OpdsActorDto (apps/api-python/app/modules/opds/application/dto.py:13); apps.api-python.app.modules.opds.application.dto.BasicCredentialsDto (apps/api-python/app/modules/opds/application/dto.py:18); apps.api-python.app.modules.opds.application.dto.OpdsAuthenticationRequestDto (apps/api-python/app/modules/opds/application/dto.py:24); apps.api-python.app.modules.opds.application.dto.OpdsLinkDto (apps/api-python/app/modules/opds/application/dto.py:32); apps.api-python.app.modules.opds.application.dto.OpdsAuthorDto (apps/api-python/app/modules/opds/application/dto.py:44). Rename to `DownloadTaskDto`. [rule N6]
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low vulnerability · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 4/7 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `apps/web`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:4 — 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 3 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.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation REDACTED:34 — `REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
R7 · Dead Code · Unused export 'fetchAllBookResources' · ×1
  • Unused export 'fetchAllBookResources' apps/web/features/books/api/client.ts:255 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'updateMetadataProviderOrder' · ×1
  • Unused export 'updateMetadataProviderOrder' apps/web/features/books/api/client.ts:483 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'updateResourceReadingStatus' · ×1
  • Unused export 'updateResourceReadingStatus' apps/web/features/books/api/client.ts:672 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'displayResourceNumber' · ×1
  • Unused export 'displayResourceNumber' apps/web/features/books/book-detail.ts:60 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'localV5ProgressPresentation' · ×1
  • Unused export 'localV5ProgressPresentation' apps/web/features/books/local-reader-progress.ts:4 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ReaderQuickActionButton' · ×1
  • Unused export 'ReaderQuickActionButton' apps/web/features/reader/ui/reader-control-primitives.tsx:69 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ContinuousItemState' · ×1
  • Unused export 'ContinuousItemState' apps/web/features/reader/v3/adapters/continuous-layout.ts:2 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ContinuousOffsetIndex' · ×1
  • Unused export 'ContinuousOffsetIndex' apps/web/features/reader/v3/adapters/continuous-layout.ts:4 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'continuousPlaceholderRanges' · ×1
  • Unused export 'continuousPlaceholderRanges' apps/web/features/reader/v3/adapters/continuous-layout.ts:16 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'estimatedContinuousHeight' · ×1
  • Unused export 'estimatedContinuousHeight' apps/web/features/reader/v3/adapters/continuous-layout.ts:20 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'epubSurfaceColor' · ×1
  • Unused export 'epubSurfaceColor' apps/web/features/reader/v3/adapters/epub-theme.ts:41 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'epubSurfaceTextColor' · ×1
  • Unused export 'epubSurfaceTextColor' apps/web/features/reader/v3/adapters/epub-theme.ts:45 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'applyEpubThemeSnapshot' · ×1
  • Unused export 'applyEpubThemeSnapshot' apps/web/features/reader/v3/adapters/epub-theme.ts:222 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'applyEpubDocumentSpacing' · ×1
  • Unused export 'applyEpubDocumentSpacing' apps/web/features/reader/v3/adapters/epub-theme.ts:247 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'PagedTrackSettleReason' · ×1
  • Unused export 'PagedTrackSettleReason' apps/web/features/reader/v3/paged-track/paged-track-physics.ts:11 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LocalizedReleaseNote' · ×1
  • Unused export 'LocalizedReleaseNote' apps/web/features/updates/model/types.ts:29 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'hasMessage' · ×1
  • Unused export 'hasMessage' apps/web/i18n/messages.ts:76 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'messageKeys' · ×1
  • Unused export 'messageKeys' apps/web/i18n/messages.ts:80 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'clearAudioDevicePreferences' · ×1
  • Unused export 'clearAudioDevicePreferences' apps/web/lib/audio-device-preferences.ts:46 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'comicPagedPreloadRadius' · ×1
  • Unused export 'comicPagedPreloadRadius' apps/web/lib/comic-preload.ts:1 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'maxComicPagedPreloadPages' · ×1
  • Unused export 'maxComicPagedPreloadPages' apps/web/lib/comic-preload.ts:2 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'comicPreloadAfterVisibleDelayMs' · ×1
  • Unused export 'comicPreloadAfterVisibleDelayMs' apps/web/lib/comic-preload.ts:3 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getReaderV5ProgressSyncCoordinator' · ×1
  • Unused export 'getReaderV5ProgressSyncCoordinator' apps/web/lib/reader/v5-sync-coordinator.ts:484 — Nothing ultimately consumes this binding: its only referrer is the re-export in apps/web/lib/reader/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in apps/web/lib/reader/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused module-local declaration 'READIUM_VERSION' · ×1
  • Unused module-local declaration 'READIUM_VERSION' apps/web/features/reader/v3/adapters/readium-adapter.ts:53 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'lowerSet' · ×1
  • Unused module-local declaration 'lowerSet' apps/web/features/reader/v3/security/reader-safety-policy.ts:466 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'nonEmptyString' · ×1
  • Unused module-local declaration 'nonEmptyString' apps/web/lib/reader/v5-wire.ts:138 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R8 · Dependency Hygiene · Test-only dependency 'sharp' in production deps · ×1
  • Test-only dependency 'sharp' in production deps REDACTED:48 — Only test files import it (first: apps/web/e2e/comic-reader.spec.ts:2) — move it to devDependencies.
X2 · Cancellation propagation · Not all functions that make a request accept an AbortSignal or the coroutine's cancellation · ×1
  • Not all functions that make a request accept an AbortSignal or the coroutine's cancellation — Only 53/68 functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http; Ktor, OkHttp newCall, URL streams) accept an AbortSignal or the coroutine's cancellation or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` () and hand it to the request; in a Kotlin suspend function, make the request with a call that suspends — Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` that cancels the `Call` — not a blocking `execute()`: `withContext(Dispatchers.IO)` moves the call off the caller's thread but does not make it cancellable; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure apps/api-python/docs/openapi-audit/runtime_probe.py:177 — `_response_shape_ok` returns `False` 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.
Minor — 1 finding(s)
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: :shared — :shared: abstractness 0.07, instability 0.00, distance 0.93 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-4fee66dbd80c4015b7a7e5508a163617/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=760" --report-format json --report-path /tmp/watchdog-gitleaks-4fee66dbd80c4015b7a7e5508a163617/history-1.json --exit-code 0 --source .17artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-4fee66dbd80c4015b7a7e5508a163617/tree.json --exit-code 0 --source .3artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude apps/web/generated .126artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .31artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .18artifacts/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 63 file(s) — `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/bootstrap/MainViewModel.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeCoreScreens.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsRepository.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/administrativesettings/AdministrativeSettingsUi.kt`, `apps/mobile/androidApp/src/main/kotlin/com/ermao/library/features/audio/application/AndroidAudioPlaybackRuntime.kt`, … (+58 more) — 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/** .0artifacts/raw/trivy-fs.json

Run 01a1eb94-77a3-7e42-a9bc-6b3d73e8b59d · 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