Public report — tidb, published 6 Aug 2026.
Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version;
ask the repo owner for the full report.
4305findings with an exact file:lineof 4323 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
38/105dimensions across the health lenses879927 LoC — wide & deep
Executive summary
Read through the Production lens — the standard calibration. *Green* means good enough to run in production. The score is absolute and comparable across repos.
pingcap/tidb is sound in substance but carries real gaps (66%). It is not in crisis, but the issues below raise the cost of changing it — friction its consumers ultimately inherit.
It is strongest in Event-Driven (100%) — its messaging keeps components properly decoupled. Architecture (99%) is solid too.
The area that most needs attention is Code Health (61%) — changes there are slower and more error-prone. Domain Modelling (64%) is the next concern — the domain model leaks and drifts, so business rules are harder to trust and change.
Leadership focus, highest impact first: strongly-typed ids across the domain (Strongly-typed ids); Make entity setters private/init-only (Encapsulated state); 50 High finding(s) (Static Analysis (SAST)).
For scale: Very large (~879,927 production lines); rebuilding it from scratch would take roughly ~19.8 person-years (~11–38 engineers). Approximate, ±~30%.
It builds on a genuinely strong Event-Driven foundation (100%); the priorities above are the highest-leverage way to bring the rest up to that level.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
0.9× (at 66% quality) — the last 20% of quality is most of the work
Size & shape
Very large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~19.8 person-years of build effort (about ~€2,900,000 to rebuild). Its weakest lens is Code Health at 61% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain High (×1.6) — CQRS, domain model, event-driven integration × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs.
Make entity setters private/init-only; change state only through methods that enforce the invariants (Marten/EF can bind via constructor or private setters).
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 93.1–558.8 engineer-days every year, paid as drag on the ~553,725 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 7–15% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 136,535 line(s) changed over a 90-day window ⇒ ~553,725/year · D1/D2/D4 code quality: averaging 5.3/10 ⇒ a 7–15% drag on each change · top-ranked remediation: Medium effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Value concentrated against a weak lens · Medium · Value at risk
This is a Very large asset (~19.8 person-years to rebuild), and its weakest lens is Code Health at 61%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
Evidence: valuation: Very large, ~19.8 person-years rebuild (879,927 LoC) · weakest lens: Code Health 61%
→ Direct remediation budget at Code Health first — highest risk-reduction per euro on an asset this size.
Root cause: an un-encapsulated domain · Medium · Root cause
32 findings across public setters, anemic types and primitive ids share one root cause — the domain layer doesn't protect its own invariants. Fixing the encapsulation pattern resolves them together, rather than chasing each finding.
→ Address encapsulation as one pattern (private setters + behaviour + strongly-typed ids), not 100 separate findings.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 5.3/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 7–15% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 5.3/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency matrix
651 modules, 2421 dependencies — every dependency points down the layering, so there are no cycles. Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
At a glance — Code Health · 61% · Adequate · gated by D2
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
50
High / Critical
A05:2021 — Security Misconfiguration
18
High / Critical
A06:2021 — Vulnerable & Outdated Components
10
High / Critical
A02:2021 — Cryptographic Failures
2
High / Critical
Roadmap
First, adopt strongly-typed IDs across the domain to eliminate transposed-argument bugs, and make entity setters private or init-only to enforce invariants through controlled methods. Next, resolve the 50 high-priority static analysis findings, beginning with server_client.go, checkpoint.go, and sql.go. Then, add a health check to the served compose service and ensure the deployed image tag remains immutable to simplify rollback procedures. Finally, add a persistence guard on critical data stores using Docker named volumes or equivalent cloud protections to prevent accidental data loss.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs.
Make entity setters private/init-only; change state only through methods that enforce the invariants (Marten/EF can bind via constructor or private setters).
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
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).
Your ecosystem's static analyzer is declared as a dependency but is not wired into CI — run it as a required step on push/PR (e.g. `composer phpstan` / `mix sobelow` / `bundle exec brakeman` / the spotbugs Gradle task / `sbt scalafixAll --check` / `golangci-lint run` / `rebar3 lint`) so a regression fails the build instead of relying on someone running it locally.
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 34 of 38 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.6 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 38 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 4305 of 4323 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.
Repo exclusion declarations: 3 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity (jscpd) — 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.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D25 ADR Conformance: ADR conformance is the LLM-scored fraction of sampled code that follows recorded decisions — it checks the decisions that were written down and the slices it sampled, not unrecorded rules or the whole tree.
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").
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.
DM4 Rich vs anemic model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
The LLM boundary
LLM-set scores this run (5): D19, D20, D21, D25, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
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.
1252 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was AlterTableSpec.Restore at 197. A further 63 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 expression.getSignatureByPB at 515 — they are counted neither in the figure above nor in this dimension's score.
+ 1245 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 indentFormatter.format (cyclomatic 23) finding(s) in Cyclomatic Complexity — start with format.go (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 main.main (cyclomatic 17) finding(s) in Cyclomatic Complexity — start with main.go, pluginpkg.go. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 AlterTableSpec.Restore (cyclomatic 197) finding(s) in Cyclomatic Complexity — start with ddl.go. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 2334 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 indentFormatter.format (cognitive 44) finding(s) in Cognitive Complexity — start with format.go (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 MyDecimal.ToString (cognitive 22) finding(s) in Cognitive Complexity — start with mydecimal.go, test_driver_mydecimal.go. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 AlterTableSpec.Restore (cognitive 315) finding(s) in Cognitive Complexity — start with ddl.go. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.4 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 264 FileTooLong finding(s) in God Classes — start with client.go (4), builder.go (3), ddl.go (3). — One of this dimension's main actionable groups (264 warning-level).
Resolve the 75 TooManyMethods finding(s) in God Classes — start with client.go (3), column.go (3), session.go (2). — One of this dimension's main actionable groups (75 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
Of 65 mechanizable ADRs, 55 are prevented by analyzers, 10 by tests, 0 exist only in prose. Coverage: 100 %. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: 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.
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.3 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
126 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pkg/util/memory/arbitrator.go.
Off-boarding risk: anonymized user #1 · ×11
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The documentation is comprehensive and well-structured for a distributed SQL database project: the README (TiDB) and its subdirectories cover TiDB, TiDB-Lightning, Dumpling, BR, LLMTest, integration test suites, and many other tools with clear headings, links to design documents, and build/run instructions. The architecture section is present in multiple files and outlines every named topic from the top-level list (TiDB; Key Features; Quick Start; Need Help?; Architecture; Contributing; License; See Also; Acknowledgments). The documentation is comprehensive across READMEs, architecture/design docs, and per-project XML-doc coverage. The timer framework usage guide is clear with an introduction, a well-structured Usage section covering client operations (create, update, delete), runtime setup, custom hook classes, and FAQs; the parser README explains its purpose, compatibility, performance claims, and future roadmap while linking to a canonical quickstart; the extension-framework usage example demonstrates session-handling registration with code and an import snippet. The lightning tests doc is thorough for its topic (external-process integration) covering preparations, running commands, test-writer guidance, and a clipped clip marker. A design-doc README walks through who initiates documents, preparation best practices, and the formal process it follows. The .github/skills README notes repository-level Codex skills migration to .agents/skills. The package's documentation is clear and complete for the table-filter interface: it defines the TableFilter type, shows an idiomatic Go example with flag parsing, a concrete syntax walkthrough (allowlist, wildcards, escape character), and links to MySQL replication rules. The READMEs are well-structured and each one covers its own topic (filter library, priority ordering, dbutil auxiliary functions). However, the allowlist section is clipped mid-sentence in the Examples doc body, so the full wildcard/regular-expression coverage and precedence sections are not visible.
What to do
Improve Documentation Quality — currently 8.9/10. — The documentation is comprehensive and well-structured for a distributed SQL database project: the README (TiDB) and its subdirectories cover TiDB, TiDB-Lightning, Dumpling, BR, LLMTest, integration test suites, and many other tools with clear headings, links to design documents, and build/run instructions. The architecture section is present in multiple files and outlines every named topic from the top-level list (TiDB; Key Features; Quick Start; Need Help?; Architecture; Contributing; License; See Also; Acknowledgments). The documentation is comprehensive across READMEs, architecture/design docs, and per-project XML-doc coverage. The timer framework usage guide is clear with an introduction, a well-structured Usage section covering client operations (create, update, delete), runtime setup, custom hook classes, and FAQs; the parser README explains its purpose, compatibility, performance claims, and future roadmap while linking to a canonical quickstart; the extension-framework usage example demonstrates session-handling registration with code and an import snippet. The lightning tests doc is thorough for its topic (external-process integration) covering preparations, running commands, test-writer guidance, and a clipped clip marker. A design-doc README walks through who initiates documents, preparation best practices, and the formal process it follows. The .github/skills README notes repository-level Codex skills migration to .agents/skills. The package's documentation is clear and complete for the table-filter interface: it defines the TableFilter type, shows an idiomatic Go example with flag parsing, a concrete syntax walkthrough (allowlist, wildcards, escape character), and links to MySQL replication rules. The READMEs are well-structured and each one covers its own topic (filter library, priority ordering, dbutil auxiliary functions). However, the allowlist section is clipped mid-sentence in the Examples doc body, so the full wildcard/regular-expression coverage and precedence sections are not visible.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality / 10Strong◐ Sampled · advisory
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
Evaluated 86 ADR(s) individually; mean quality 8.0/10 (mixed — many ADRs miss context or consequences). 1 flagged with a specific gap.
Context/problem and consequences/trade-offs are both present but thin: the body describes only the architecture (queues, job types, roles, states) without explaining why a single-node owner model is chosen over locking tables or how the trade-offs of concurrency vs. consistency play outdocs/design/2018-10-08-online-DDL.md
ADR lacks an enforcement field · ×85docs/design/2018-07-01-refactor-aggregate-framework.md
What to do
Resolve the 85 ADR lacks an enforcement field finding(s) in ADR Quality — start with 2018-07-01-refactor-aggregate-framework.md, 2018-07-19-row-format.md, 2018-07-22-enhance-propagations.md. — One of this dimension's main actionable groups (85 recommendation-level).
Resolve the 1 Context/problem and consequences/trade-offs are both present but thin finding(s) in ADR Quality — start with 2018-10-08-online-DDL.md. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
What it measures: Whether the code actually follows the decisions recorded in the project's ADRs.
Method: Judged by language model at low temperature against ADRs plus a deterministic structural code summary; findings linked to repo-rooted ADR paths for traceability. Advisory.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
Secret: private-keybr/compatibility/credentials/application_default_credentials.json:3detected by gitleaks finding
Rotate the exposed credentials — git history can't be un-committed
✓ On the Gold path — maintain.
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
High: github-actions-mutable-action-tag · ×50.github/actions/tidb_build/action.yml:18detected by semgrep finding
What to do
Resolve the 50 High finding(s) in Static Analysis (SAST) — start with server_client.go (25), checkpoint.go (10), sql.go (4). — One of this dimension's main actionable groups (50 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
High IaC: DS-0002 · ×6Dockerfiledetected by trivy finding
Medium IaC: DS-0013 · ×9br/docker/Dockerfiledetected by trivy finding
Low IaC: DS-0026 · ×3Dockerfiledetected by trivy finding
What to do
Resolve the 6 High IaC finding(s) in IaC & Container Security — start with Dockerfile (5), Dockerfile.enterprise. — One of this dimension's main actionable groups (6 issue-level).
Resolve the 9 Medium IaC finding(s) in IaC & Container Security — start with Dockerfile (8), Dockerfile.enterprise. — One of this dimension's main actionable groups (9 warning-level).
Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with Dockerfile (2), Dockerfile.enterprise. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
83 of 1742 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pkg/parser/mysql/errname.go.
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; coupling through a build step, config, or non-source file isn't seen.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.
Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.
High CVE: [GHSA redacted]go.moddetected by osv-scanner finding
High vulnerability: [GHSA redacted]go.moddetected by osv-scanner finding
Medium CVE: GO-2026-4503 · ×7go.moddetected by osv-scanner finding
Medium vulnerability: GO-2026-5932go.moddetected by osv-scanner finding
What to do
Resolve the 1 High CVE finding(s) in OSV Dependency Vulnerabilities — start with go.mod. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 High vulnerability finding(s) in OSV Dependency Vulnerabilities — start with go.mod. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 7 Medium CVE finding(s) in OSV Dependency Vulnerabilities — start with go.mod (7). — One of this dimension's main actionable groups (7 warning-level).
Detailed fixes: d38_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Other · Domain Modelling — Whether aggregates reference each other by identity (id) rather than by direct object reference — the core DDD consistency-boundary rule.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Other · Domain Modelling — How much of the domain uses strongly-typed ids vs raw Guid/string/int — adoption curve, not all-or-nothing.
Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. Deterministic, adoption percentage.
Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.
`ColumnInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — column.go:87
`IndexInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — index.go:261
`Job.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — job.go:354
`Job.SchemaID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — job.go:358
`Job.TableID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — job.go:361
`Job.DependencyID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — job.go:394
`PolicyInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — placement.go:133
`ResourceGroupInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — resource_group.go:181
`TableInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:114
`TableInfo.AutoIncID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:134
`TableInfo.AutoRandID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:151
`TableInfo.MaxColumnID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:152
`TableInfo.MaxIndexID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:153
`TableInfo.MaxForeignKeyID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:154
`TableInfo.MaxConstraintID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:155
`TableInfo.AutoIDSchemaID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:166
`TableInfo.DBID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:228
`PartitionInfo.NewTableID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:875
`PartitionDefinition.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:1201
`ConstraintInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:1250
`FKInfo.ID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — table.go:1270
What to do
Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs.
Do you agree with this assessment?
DM4 · Rich vs anemic model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether aggregates/entities carry the behaviour that protects their invariants, rather than being data bags driven by external services.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether entities protect their state (private/init-only setters) instead of exposing public setters that bypass invariants. Softened when a rehydration framework (Marten/EF) is present.
Method: Roslyn (DDD-gated): public setters on entities detected; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
`Domain` exposes exported guard-free setter(s) (SetOnClose) that rewrite business state without enforcing invariants. — domain.go:940
Make entity setters private/init-only; change state only through methods that enforce the invariants (Marten/EF can bind via constructor or private setters).
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies (EF/Marten/HTTP/ASP.NET) — the clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Other · Domain Modelling — Whether clusters of primitives that travel together (a missing value object) are extracted — a low-weight suggestion, LLM-confirmed when configured.
Method: Roslyn (DDD-gated): primitive parameter clusters recurring three or more times across signatures extracted, then confirmed by language model when configured. Advisory, low-weight.
Other · Event-Driven — Whether commands have a single handler (one owner of the decision) and fan-out is modelled with events.
Method: Roslyn scan (event-driven gated): command-shaped messages identified by convention; handler count per command checked for the exactly-one rule. Deterministic, hard fact.
Do you agree with this assessment?
ED3 · Event naming7.0 / 10Strong✓ Tool-verified
Other · Event-Driven — Whether events are named in the past tense (a clarity nudge — low weight).
Method: Roslyn scan (event-driven gated): domain and integration events checked for past-tense naming (-ed/-en suffix or irregular set). Naming nudge, low-weight advisory.
`PrivilegeEvent` reads as an instruction, not a fact that happened. Events describe something that already occurred — name them in the past tense (e.g. `OrderPlaced`, `PaymentCaptured`) so the ubiquitous language stays clear. — domain.go:2472
What to do
Name events in the past tense — they record facts that already happened.
Other · Event-Driven — Whether state changes and message publishes are atomic (a transactional outbox) rather than a crash-unsafe dual write.
Method: Roslyn semantic scan (event-driven gated): event-handler methods scanned for DB-save plus bus-publish without a transactional outbox reference. Deterministic, semantic-resolved.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
1043 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.
What to do
Add a 'Testing' section to the root README — how to run the test suite.
Review the README against recent changes; refresh the parts that drifted.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Your ecosystem's static analyzer is declared as a dependency but is not wired into CI — run it as a required step on push/PR (e.g. `composer phpstan` / `mix sobelow` / `bundle exec brakeman` / the spotbugs Gradle task / `sbt scalafixAll --check` / `golangci-lint run` / `rebar3 lint`) so a regression fails the build instead of relying on someone running it locally.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Deployment is orchestrated by compose, and the service already exposes health probe endpoints (healthz/livez/readyz or a container healthcheck), but no compose service declares a `healthcheck:` that uses them and nothing pins a previous image to fall back to — so a release that starts but does not serve looks healthy, and reversing it is a manual step.
What to do
Add a `healthcheck:` to the served compose service — probing the endpoint it already answers on where it has one — with `depends_on: condition: service_healthy` on whatever waits for it, and keep the deployed image tag immutable and recorded so rolling back is re-pointing at the previous tag rather than rebuilding.
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
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).
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Not included — 67 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — no DI registrations detected
AX10 Code composition — not assessed — code composition is computed by ROLE over a document set that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) 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
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
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.
D10 Test Quality — ~629720 lines of test source are present (.go) but the test-quality collector reads C# only, so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included
D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
D14 License Compliance — Not scored — this repository's package manifest is not parsed for licence data yet. A gap in the analyzer's language coverage, NOT a finding that the repository's licenses are compliant (a Go module (go.mod/go.sum)), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
D17 Explicit Debt — explicit-debt markers are read through a C# workspace today, so they were not read for this repository's language — this asserts nothing about how many markers the code carries. Not scored — this is a gap in the analyzer, not a finding about this repository
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 — No exposed public API
D23 Boundary Type-Coupling — Production source is present (.go) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Go module (go.mod/go.sum) — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
D32 Data Compliance (PII/GDPR) — No PII/GDPR-handling patterns detected (p/gdpr ruleset) — no data-compliance surface to assess.
D33 JS/npm Dependency Vulnerabilities — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.
D36 Supply-chain Provenance & Signing — The CI pipeline builds and tests but publishes no released artifact — no package publish, container push, GitHub release or deployment step. Supply-chain provenance, signing and SBOM attest RELEASED artifacts, so there is nothing to attest here. Add them to the release pipeline when this repo starts shipping artifacts (a published package, a container image, a deployed service or a tagged release).
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is mostly .go, which this pass does not read, so cohesion was not assessed for this repository. Not scored — this is a gap in the analyzer, not a finding about this repository.
D8 Code Coverage — Coverage not included — suite not readable by the collector
D9 Test Distribution — Test source is present (.go) but the test-pyramid classifier reads C# only, so its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
ED1 Handler temporal coupling — no event handlers detected — temporal-coupling check not applicable
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 1 aggregate(s) with Apply/When folds; 15 Go aggregate(s) recording domain events (own events-slice append / raise-record)
GD1 Unfinished & placeholder code — no source files
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, 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'.
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from 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
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
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.
X1 Async correctness — 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
X2 Cancellation propagation — 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
X3 Exception handling — 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
X4 Structured logging — 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
X5 Nullable reference types — 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
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.
High: github-actions-mutable-action-tag .github/actions/tidb_build/action.yml:18— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: bazel-contrib/setup-bazel@<40-character SHA>`. This step references `bazel-contrib/setup-bazel@0.16.0`; resolve the SHA it points at today with `gh api repos/bazel-contrib/setup-bazel/commits/0.16.0 --jq .sha`. Note that `0.16.0` is an exact release tag rather than a floating major: it is still mutable (a tag can be repointed), but by convention it moves only on a force-push, so pin the floating-major and branch references in this file first.
High: github-actions-mutable-action-tag .github/actions/tidb_build/action.yml:44— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/setup-go@<40-character SHA>`. This step references `actions/setup-go@v6`; resolve the SHA it points at today with `gh api repos/actions/setup-go/commits/v6 --jq .sha`.
High: dependabot-missing-cooldown .github/dependabot.yml:3— This Dependabot configuration does not set a cooldown period. Newly published packages can be malicious or unstable. Add a `cooldown` block with `default-days: 7` to each `package-ecosystem` entry under `updates` to wait 7 days before proposing updates to newly published package versions. Reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#cooldown. This is a semgrep security-AUDIT rule reporting a POLICY that is absent or weaker than its recommendation, not an exploitable defect. Confirm whether the current setting is a deliberate decision for this repository — and apply the change where it is not; where it is (a policy your release process already enforces elsewhere, or one this repository has consciously opted out of), record the decision and leave the configuration as it is. This configuration file has 2 such entries; one cooldown decision clears them all — reported once.
High: string-formatted-query dumpling/export/sql.go:325— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query dumpling/export/sql.go:439— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query dumpling/export/sql.go:731— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query dumpling/export/sql.go:985— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importer/table_import.go:1643— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importer/table_import.go:1698— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importer/tidb.go:92— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:397— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:402— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:420— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:442— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:458— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:462— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:471— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:476— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:570— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query lightning/pkg/importinto/checkpoint.go:595— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is. Note what is being interpolated here: the statement takes the value in a position where SQL expects a table, view or schema NAME, and a name cannot be bound as a query parameter in any driver — the statement has to be planned before the parameter is known, so "use a parameterised query" is not available for this site. The control that IS available: check the name against a fixed allow-list of the identifiers this code may address (or derive it from one) before it reaches the statement, and where the name is genuinely dynamic, pass it through the driver's identifier-quoting helper rather than into the format string. If the name can only ever come from configuration you control, say so at the call site — that is the review this row is asking for.
High: string-formatted-query pkg/importsdk/job_manager.go:74— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query pkg/importsdk/job_manager.go:97— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query pkg/importsdk/job_manager.go:123— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query pkg/importsdk/job_manager.go:243— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
High: string-formatted-query pkg/lightning/common/util.go:615— String-formatted SQL query detected. This could lead to SQL injection if the string is not sanitized properly. Audit this call to ensure the SQL is not manipulable by external data. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Orphaned knowledge pkg/parser/mysql/errname.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pkg/parser/mysql/errcode.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pkg/parser/charset/encoding_gb18030_data.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pkg/util/extsort/disk_sorter.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge br/pkg/task/operator/test_storage.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pkg/infoschema/perfschema/const.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pkg/executor/internal/calibrateresource/calibrate_resource.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
High IaC: DS-0002 Dockerfile— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN useradd -r -M app` — or whatever this base image's account tooling is, `adduser` and `useradd` are not both present everywhere`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
High IaC: DS-0002 Dockerfile.enterprise— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN useradd -r -M app` — or whatever this base image's account tooling is, `adduser` and `useradd` are not both present everywhere`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
High IaC: DS-0002 br/docker/Dockerfile— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN adduser -S -D app`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
High IaC: DS-0002 tools/patch-go/Dockerfile— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN adduser --system --no-create-home app`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
High IaC: DS-0021 tools/patch-go/Dockerfile— 'apt-get' missing '-y' to avoid manual input
High IaC: DS-0029 tools/patch-go/Dockerfile— 'apt-get' missing '--no-install-recommends'
D38 · OSV Dependency Vulnerabilities· High CVE · ×1
High CVE: [GHSA redacted] go.mod— github.com/prometheus/prometheus 0.50.1: [GHSA redacted] — upgrade to 0.305.2. This one row stands for the 4 advisories this scan raises against github.com/prometheus/prometheus 0.50.1: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
D38 · OSV Dependency Vulnerabilities· High vulnerability · ×1
High vulnerability: [GHSA redacted] go.mod— google.golang.org/grpc 1.82.0: [GHSA redacted] — upgrade to 1.82.1
FileTooLong: core/logical_plan_builder.go pkg/planner/core/logical_plan_builder.go:0— FileTooLong — 5121 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ddl/executor.go pkg/ddl/executor.go:0— FileTooLong — 5094 significant lines (blank, comment-only and punctuation-only lines excluded). 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: expression/builtin_time.go pkg/expression/builtin_time.go:0— FileTooLong — 4504 significant lines (blank, comment-only and punctuation-only lines excluded). 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: core/planbuilder.go pkg/planner/core/planbuilder.go:0— FileTooLong — 4449 significant lines (blank, comment-only and punctuation-only lines excluded). 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: executor/builder.go pkg/executor/builder.go:0— FileTooLong — 4421 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ast/ddl.go pkg/parser/ast/ddl.go:0— FileTooLong — 3699 significant lines (blank, comment-only and punctuation-only lines excluded). 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: session/session.go pkg/session/session.go:0— FileTooLong — 3643 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ddl/partition.go pkg/ddl/partition.go:0— FileTooLong — 3302 significant lines (blank, comment-only and punctuation-only lines excluded). 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: variable/sysvar.go pkg/sessionctx/variable/sysvar.go:0— FileTooLong — 3129 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: defaultSysVars (143-4117). 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: executor/infoschema_reader.go pkg/executor/infoschema_reader.go:0— FileTooLong — 3116 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ast/misc.go pkg/parser/ast/misc.go:0— FileTooLong — 3049 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ast/dml.go pkg/parser/ast/dml.go:0— FileTooLong — 2802 significant lines (blank, comment-only and punctuation-only lines excluded). 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: ddl/index.go pkg/ddl/index.go:0— FileTooLong — 2787 significant lines (blank, comment-only and punctuation-only lines excluded). 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: expression/builtin_string.go pkg/expression/builtin_string.go:0— FileTooLong — 2745 significant lines (blank, comment-only and punctuation-only lines excluded). 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: infoschema/metric_table_def.go pkg/infoschema/metric_table_def.go:0— FileTooLong — 2506 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: MetricTableMap (19-3180). 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: executor/simple.go pkg/executor/simple.go:0— FileTooLong — 2377 significant lines (blank, comment-only and punctuation-only lines excluded). 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: testserverclient/server_client.go pkg/server/internal/testserverclient/server_client.go:0— FileTooLong — 2327 significant lines (blank, comment-only and punctuation-only lines excluded). 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: infoschema/tables.go pkg/infoschema/tables.go:0— FileTooLong — 2227 significant lines (blank, comment-only and punctuation-only lines excluded). 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: expression/builtin_string_vec.go pkg/expression/builtin_string_vec.go:0— FileTooLong — 2195 significant lines (blank, comment-only and punctuation-only lines excluded). 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: core/expression_rewriter.go pkg/planner/core/expression_rewriter.go:0— FileTooLong — 2162 significant lines (blank, comment-only and punctuation-only lines excluded). 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: types/time.go pkg/types/time.go:0— FileTooLong — 2119 significant lines (blank, comment-only and punctuation-only lines excluded). 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: expression/builtin_compare.go pkg/expression/builtin_compare.go:0— FileTooLong — 2095 significant lines (blank, comment-only and punctuation-only lines excluded). 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: expression/builtin_time_vec.go pkg/expression/builtin_time_vec.go:0— FileTooLong — 2052 significant lines (blank, comment-only and punctuation-only lines excluded). 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: executor/show.go pkg/executor/show.go:0— FileTooLong — 2008 significant lines (blank, comment-only and punctuation-only lines excluded). 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: copr/coprocessor.go pkg/store/copr/coprocessor.go:0— FileTooLong — 1981 significant lines (blank, comment-only and punctuation-only lines excluded). 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.
TooManyMethods: PlanBuilder pkg/planner/core/planbuilder.go:208— TooManyMethods — 180 methods, declared across 4 files: core/logical_plan_builder.go (89), core/planbuilder.go (86), core/expression_rewriter.go (4), core/subquery_plan_builder.go (1). 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: Domain pkg/domain/domain.go:149— TooManyMethods — 149 methods, declared across 7 files: domain/domain.go (125), domain/domain_sysvars.go (8), domain/sysvar_cache.go (6), domain/test_helper.go (5), +3 more file(s). 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: session pkg/session/session.go:194— TooManyMethods — 146 methods, declared across 2 files: session/session.go (143), session/txn.go (3). 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: MemArbitrator pkg/util/memory/arbitrator.go:530— TooManyMethods — 130 methods. 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: SessionVars pkg/sessionctx/variable/session.go:809— TooManyMethods — 123 methods, declared across 2 files: variable/session.go (122), variable/slow_log.go (1). 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: Mutator pkg/meta/meta.go:219— TooManyMethods — 117 methods. 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: executor pkg/ddl/executor.go:189— TooManyMethods — 116 methods, declared across 3 files: ddl/executor.go (113), ddl/sanity_check.go (2), ddl/engine_attribute.go (1). 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: executorBuilder pkg/executor/builder.go:106— TooManyMethods — 116 methods, declared across 4 files: executor/builder.go (110), executor/foreign_key.go (3), executor/brie.go (2), executor/point_get.go (1). 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: StatementContext pkg/sessionctx/stmtctx/stmtctx.go:226— TooManyMethods — 102 methods. 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: clientConn pkg/server/conn.go:171— TooManyMethods — 97 methods, declared across 5 files: server/conn.go (71), server/conn_stmt.go (16), server/extension.go (4), server/user_connections.go (4), +1 more file(s). 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: worker pkg/ddl/job_worker.go:180— TooManyMethods — 96 methods, declared across 14 files: ddl/index.go (19), ddl/masking_policy.go (19), ddl/job_worker.go (17), ddl/table.go (10), +10 more file(s). 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: SnapClient br/pkg/restore/snap_client/client.go:86— TooManyMethods — 87 methods, declared across 4 files: snap_client/client.go (66), snap_client/pipeline_items.go (8), snap_client/systable_restore.go (7), snap_client/tikv_sender.go (6). 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: ShowExec pkg/executor/show.go:93— TooManyMethods — 85 methods, declared across 5 files: executor/show.go (49), executor/show_stats.go (19), executor/show_placement.go (15), executor/brie.go (1), +1 more file(s). 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: Column pkg/util/chunk/column.go:74— TooManyMethods — 84 methods. 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: TaskManager pkg/dxf/framework/storage/task_table.go:131— TooManyMethods — 82 methods, declared across 5 files: storage/task_table.go (44), storage/task_state.go (15), storage/nodes.go (11), storage/subtask_state.go (8), +1 more file(s). 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: Context pkg/util/mock/context.go:68— TooManyMethods — 82 methods. 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: Server pkg/server/server.go:128— TooManyMethods — 78 methods, declared across 5 files: server/server.go (62), server/http_status.go (10), server/http_handler.go (3), server/stat.go (2), +1 more file(s). 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: deserializeHelper pkg/executor/aggfuncs/spill_deserialize_helper.go:25— TooManyMethods — 70 methods. 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: SerializeHelper pkg/executor/aggfuncs/spill_serialize_helper.go:22— TooManyMethods — 70 methods. 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: Server pkg/store/mockstore/unistore/tikv/server.go:48— TooManyMethods — 70 methods, declared across 2 files: tikv/server.go (68), tikv/server_batch.go (2). 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: LogClient br/pkg/restore/log_client/client.go:166— TooManyMethods — 65 methods, declared across 3 files: log_client/client.go (54), log_client/id_map.go (10), log_client/flow_control.go (1). 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: TestServerClient pkg/server/internal/testserverclient/server_client.go:72— TooManyMethods — 60 methods. 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: expressionRewriter pkg/planner/core/expression_rewriter.go:352— TooManyMethods — 58 methods, declared across 2 files: core/expression_rewriter.go (57), core/fulltext_to_like.go (1). 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: Chunk pkg/util/chunk/chunk.go:35— TooManyMethods — 58 methods, declared across 2 files: chunk/chunk.go (56), chunk/compare.go (2). 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: memtableRetriever pkg/executor/infoschema_reader.go:97— TooManyMethods — 57 methods. 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.
Duplicated block (9 lines × 2) br/pkg/aws/ebs.go:300— br/pkg/aws/ebs.go:300-308 | br/pkg/aws/ebs.go:689-697 — both copies are in the same file, so extract the block into 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) br/pkg/checkpoint/manager.go:97— br/pkg/checkpoint/manager.go:97-105 | br/pkg/checkpoint/manager.go:121-129 — both copies are in the same file, so extract the 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 `br/pkg/checkpoint/manager.go:97` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) br/pkg/restore/ingestrec/ingest_recorder.go:103— br/pkg/restore/ingestrec/ingest_recorder.go:103-113 | br/pkg/restore/ingestrec/ingest_recorder.go:121-129 — both copies are in the same file, so extract the 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 `br/pkg/restore/ingestrec/ingest_recorder.go:103` 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) br/pkg/restore/internal/rawkv/rawkv_client.go:99— br/pkg/restore/internal/rawkv/rawkv_client.go:99-107 | br/pkg/restore/internal/rawkv/rawkv_client.go:121-129 — both copies are in the same file, so extract the 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 `br/pkg/restore/internal/rawkv/rawkv_client.go:99` 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 (9 lines × 2) br/pkg/restore/misc.go:548— br/pkg/restore/misc.go:548-556 | br/pkg/restore/snap_client/import.go:458-466 — 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 `br/pkg/restore/misc.go:548` 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) br/pkg/restore/snap_client/import.go:869— br/pkg/restore/snap_client/import.go:869-877 | br/pkg/restore/snap_client/import.go:988-996 — both copies are in the same file, so extract the 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 `br/pkg/restore/snap_client/import.go:869` 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) br/pkg/restore/snap_client/systable_restore.go:625— br/pkg/restore/snap_client/systable_restore.go:625-633 | br/pkg/restore/snap_client/systable_restore.go:677-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/snap_client/systable_restore.go:625` 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) br/pkg/utils/json.go:88— br/pkg/utils/json.go:88-96 | br/pkg/utils/json.go:116-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) dumpling/export/dump.go:82— dumpling/export/dump.go:82-90 | lightning/pkg/server/lightning.go:322-330 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) pkg/autoid_service/autoid.go:121— pkg/autoid_service/autoid.go:121-130 | pkg/autoid_service/autoid.go:197-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/autoid_service/autoid.go:121` 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 (9 lines × 2) pkg/ddl/add_column.go:676— pkg/ddl/add_column.go:676-684 | pkg/ddl/add_column.go:786-795 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/add_column.go:676` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) pkg/ddl/add_column.go:698— pkg/ddl/add_column.go:698-706 | pkg/ddl/add_column.go:755-763 — both copies are in the same file, so extract the 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 `pkg/ddl/add_column.go:698` 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 (9 lines × 2) pkg/ddl/cluster.go:396— pkg/ddl/cluster.go:396-404 | pkg/ddl/cluster.go:407-415 — both copies are in the same file, so extract the 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 `pkg/ddl/cluster.go:396` 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) pkg/ddl/create_table.go:65— pkg/ddl/create_table.go:65-73 | pkg/ddl/table.go:184-192 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once.
Duplicated block (9 lines × 2) pkg/ddl/create_table.go:136— pkg/ddl/create_table.go:136-145 | pkg/ddl/table.go:574-582 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/create_table.go:136` 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) pkg/ddl/executor.go:5875— pkg/ddl/executor.go:5875-5884 | pkg/ddl/executor.go:5981-5989 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:5875` 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) pkg/ddl/executor.go:6404— pkg/ddl/executor.go:6404-6412 | pkg/ddl/executor.go:6492-6500 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:6404` 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 (9 lines × 2) pkg/ddl/index.go:2027— pkg/ddl/index.go:2027-2035 | pkg/ddl/modify_column.go:1352-1360 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/index.go:2027` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) pkg/ddl/modify_column.go:1110— pkg/ddl/modify_column.go:1110-1118 | pkg/ddl/modify_column.go:1175-1183 — both copies are in the same file, so extract the block into 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) pkg/ddl/modify_column.go:1421— pkg/ddl/modify_column.go:1421-1429 | pkg/ddl/schematracker/dm_tracker.go:611-619 — 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 `pkg/ddl/modify_column.go:1421` 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) pkg/ddl/partition.go:1776— pkg/ddl/partition.go:1776-1784 | pkg/ddl/partition.go:1799-1807 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:1776` 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 (9 lines × 2) pkg/ddl/partition.go:2055— pkg/ddl/partition.go:2055-2063 | pkg/ddl/partition.go:2068-2079 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:2055` 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) pkg/ddl/table.go:1493— pkg/ddl/table.go:1493-1501 | pkg/ddl/table.go:1531-1539 — both copies are in the same file, so extract the block into 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) pkg/domain/infosync/info.go:246— pkg/domain/infosync/info.go:246-254 | pkg/domain/infosync/info.go:259-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 `pkg/domain/infosync/info.go:246` 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) pkg/dxf/framework/storage/task_table.go:594— pkg/dxf/framework/storage/task_table.go:594-602 | pkg/dxf/framework/storage/task_table.go:617-625 — both copies are in the same file, so extract the 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 `pkg/dxf/framework/storage/task_table.go:594` 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) br/pkg/restore/snap_client/import.go:803— br/pkg/restore/snap_client/import.go:803-812 | br/pkg/restore/snap_client/import.go:926-935 — both copies are in the same file, so extract the 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 `br/pkg/restore/snap_client/import.go:803` 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) br/pkg/restore/split/split.go:392— br/pkg/restore/split/split.go:392-401 | br/pkg/streamhelper/regioniter.go:123-132 — 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 `br/pkg/restore/split/split.go:392` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) br/pkg/restore/tiflashrec/tiflash_recorder.go:120— br/pkg/restore/tiflashrec/tiflash_recorder.go:120-129 | br/pkg/restore/tiflashrec/tiflash_recorder.go:147-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/tiflashrec/tiflash_recorder.go:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) br/pkg/restore/utils/rewrite_rule.go:443— br/pkg/restore/utils/rewrite_rule.go:443-452 | br/pkg/restore/utils/rewrite_rule.go:472-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/utils/rewrite_rule.go:443` 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) br/pkg/stream/rewrite_meta_rawkv.go:141— br/pkg/stream/rewrite_meta_rawkv.go:141-150 | br/pkg/stream/rewrite_meta_rawkv.go:253-262 — both copies are in the same file, so extract the 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 `br/pkg/stream/rewrite_meta_rawkv.go:141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) br/pkg/task/backup.go:247— br/pkg/task/backup.go:247-256 | br/pkg/task/restore.go:600-609 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup.go:247` 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) dumpling/export/dump.go:566— dumpling/export/dump.go:566-575 | dumpling/export/dump.go:620-629 — both copies are in the same file, so extract the 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) lightning/pkg/checkpoints/checkpoints.go:1799— lightning/pkg/checkpoints/checkpoints.go:1799-1808 | lightning/pkg/importinto/checkpoint.go:548-559 — 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 `lightning/pkg/checkpoints/checkpoints.go:1799` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/ddl/add_column.go:730— pkg/ddl/add_column.go:730-739 | pkg/ddl/add_column.go:757-766 — both copies are in the same file, so extract the 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 `pkg/ddl/add_column.go:730` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/ddl/backfilling_import_cloud.go:140— pkg/ddl/backfilling_import_cloud.go:140-149 | pkg/dxf/importinto/task_executor.go:756-765 — 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 `pkg/ddl/backfilling_import_cloud.go:140` 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) pkg/ddl/create_table.go:243— pkg/ddl/create_table.go:243-253 | pkg/ddl/create_table.go:288-297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pkg/ddl/executor.go:727— pkg/ddl/executor.go:727-736 | pkg/ddl/schematracker/dm_tracker.go:143-152 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) pkg/ddl/executor.go:1514— pkg/ddl/executor.go:1514-1523 | pkg/ddl/schematracker/dm_tracker.go:270-279 — 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 (10 lines × 2) pkg/ddl/executor.go:3441— pkg/ddl/executor.go:3441-3450 | pkg/ddl/executor.go:3581-3590 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3441` 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) pkg/ddl/executor.go:3634— pkg/ddl/executor.go:3634-3643 | pkg/ddl/executor.go:3836-3845 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3634` 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) pkg/ddl/executor.go:3671— pkg/ddl/executor.go:3671-3680 | pkg/ddl/executor.go:4196-4205 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3671` 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) pkg/ddl/foreign_key.go:410— pkg/ddl/foreign_key.go:410-419 | pkg/ddl/foreign_key.go:423-432 — both copies are in the same file, so extract the 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 `pkg/ddl/foreign_key.go:410` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/ddl/masking_policy.go:41— pkg/ddl/masking_policy.go:41-50 | pkg/ddl/masking_policy.go:123-133 — both copies are in the same file, so extract the 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.
Duplicated block (10 lines × 2) pkg/ddl/masking_policy.go:88— pkg/ddl/masking_policy.go:88-97 | pkg/ddl/masking_policy.go:106-115 — both copies are in the same file, so extract the 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 `pkg/ddl/masking_policy.go:88` 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) pkg/ddl/modify_column.go:1014— pkg/ddl/modify_column.go:1014-1023 | pkg/ddl/modify_column.go:1234-1243 — both copies are in the same file, so extract the 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 `pkg/ddl/modify_column.go:1014` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/ddl/serverstate/syncer.go:152— pkg/ddl/serverstate/syncer.go:152-162 | pkg/domain/serverinfo/syncer.go:451-460 — 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 `pkg/ddl/serverstate/syncer.go:152` 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) pkg/domain/infosync/resource_manager_client.go:93— pkg/domain/infosync/resource_manager_client.go:93-103 | pkg/domain/infosync/resource_manager_client.go:111-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/domain/infosync/resource_manager_client.go:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/domain/infosync/tiflash_manager.go:523— pkg/domain/infosync/tiflash_manager.go:523-532 | pkg/domain/infosync/tiflash_manager.go:560-569 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/domain/infosync/tiflash_manager.go:523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 lines × 2) pkg/dxf/framework/storage/task_table.go:664— pkg/dxf/framework/storage/task_table.go:664-673 | pkg/dxf/framework/storage/task_table.go:1087-1096 — both copies are in the same file, so extract the 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 `pkg/dxf/framework/storage/task_table.go:664` 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 (7 lines × 2) br/pkg/registry/registration.go:317— br/pkg/registry/registration.go:317-323 | br/pkg/registry/registration.go:999-1006 — both copies are in the same file, so extract the 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 `br/pkg/registry/registration.go:317` 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) br/pkg/restore/ingestrec/foreign_key.go:88— br/pkg/restore/ingestrec/foreign_key.go:88-94 | br/pkg/restore/ingestrec/foreign_key.go:98-104 — both copies are in the same file, so extract the 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 `br/pkg/restore/ingestrec/foreign_key.go:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) br/pkg/restore/split/sum_sorted.go:147— br/pkg/restore/split/sum_sorted.go:147-153 | br/pkg/streamhelper/spans/sorted.go:139-145 — 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 `br/pkg/restore/split/sum_sorted.go:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) br/pkg/task/operator/test_storage.go:703— br/pkg/task/operator/test_storage.go:703-709 | br/pkg/task/operator/test_storage.go:711-717 — both copies are in the same file, so extract the 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 `br/pkg/task/operator/test_storage.go:703` 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 (7 lines × 2) br/pkg/task/restore.go:2870— br/pkg/task/restore.go:2870-2876 | br/pkg/task/stream.go:1387-1393 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/restore.go:2870` 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 (7 lines × 2) br/pkg/utils/register.go:147— br/pkg/utils/register.go:147-153 | br/pkg/utils/register.go:172-178 — both copies are in the same file, so extract the 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 `br/pkg/utils/register.go:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) lightning/pkg/importer/get_pre_info.go:493— lightning/pkg/importer/get_pre_info.go:493-499 | lightning/pkg/importer/get_pre_info.go:669-675 — both copies are in the same file, so extract the 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 `lightning/pkg/importer/get_pre_info.go:493` 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) lightning/pkg/importer/table_import.go:1778— lightning/pkg/importer/table_import.go:1778-1784 | lightning/pkg/importer/table_import.go:1786-1792 — both copies are in the same file, so extract the 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 `lightning/pkg/importer/table_import.go:1778` 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 (7 lines × 2) pkg/autoid_service/autoid.go:228— pkg/autoid_service/autoid.go:228-234 | pkg/autoid_service/autoid.go:270-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (7 lines × 2) pkg/ddl/backfilling_dist_scheduler.go:615— pkg/ddl/backfilling_dist_scheduler.go:615-621 | pkg/dxf/importinto/planner.go:602-609 — 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 `pkg/ddl/backfilling_dist_scheduler.go:615` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/ddl/backfilling_operators.go:1312— pkg/ddl/backfilling_operators.go:1312-1318 | pkg/ddl/index_merge_tmp.go:252-258 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/backfilling_operators.go:1312` 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 (7 lines × 2) pkg/ddl/create_table.go:491— pkg/ddl/create_table.go:491-500 | pkg/ddl/create_table.go:780-786 — both copies are in the same file, so extract the 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 `pkg/ddl/create_table.go:491` 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) pkg/ddl/create_table.go:1697— pkg/ddl/create_table.go:1697-1703 | pkg/ddl/executor.go:5411-5417 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. 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 (7 lines × 2) pkg/ddl/executor.go:2368— pkg/ddl/executor.go:2368-2374 | pkg/ddl/executor.go:2966-2972 — both copies are in the same file, so extract the 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.
Duplicated block (7 lines × 2) pkg/ddl/executor.go:3571— pkg/ddl/executor.go:3571-3577 | pkg/ddl/schematracker/dm_tracker.go:709-715 — 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 (7 lines × 2) pkg/ddl/executor.go:4646— pkg/ddl/executor.go:4646-4652 | pkg/ddl/executor.go:4655-4661 — both copies are in the same file, so extract the 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 (7 lines × 2) pkg/ddl/partition.go:1545— pkg/ddl/partition.go:1545-1551 | pkg/ddl/partition.go:1640-1646 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:1545` 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) pkg/distsql/request_builder.go:540— pkg/distsql/request_builder.go:540-546 | pkg/distsql/request_builder.go:766-772 — both copies are in the same file, so extract the 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 `pkg/distsql/request_builder.go:540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) pkg/dxf/importinto/scheduler.go:787— pkg/dxf/importinto/scheduler.go:787-796 | pkg/dxf/importinto/scheduler.go:849-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/dxf/importinto/scheduler.go:787` 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) br/pkg/aws/ebs.go:337— br/pkg/aws/ebs.go:337-344 | br/pkg/aws/ebs.go:506-513 — both copies are in the same file, so extract the 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 `br/pkg/aws/ebs.go:337` 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) br/pkg/restore/internal/prealloc_db/db.go:201— br/pkg/restore/internal/prealloc_db/db.go:201-208 | br/pkg/restore/internal/prealloc_db/db.go:256-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/internal/prealloc_db/db.go:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) br/pkg/restore/snap_client/import.go:1087— br/pkg/restore/snap_client/import.go:1087-1094 | br/pkg/restore/snap_client/import.go:1180-1187 — both copies are in the same file, so extract the 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 `br/pkg/restore/snap_client/import.go:1087` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) br/pkg/restore/split/split.go:379— br/pkg/restore/split/split.go:379-387 | br/pkg/streamhelper/regioniter.go:106-113 — 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 `br/pkg/restore/split/split.go:379` 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 (8 lines × 2) br/pkg/task/operator/checksum_table.go:84— br/pkg/task/operator/checksum_table.go:84-91 | br/pkg/task/operator/checksum_table.go:508-515 — both copies are in the same file, so extract the 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.
Duplicated block (8 lines × 2) pkg/ddl/executor.go:3262— pkg/ddl/executor.go:3262-3269 | pkg/ddl/executor.go:5478-5485 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3262` 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) pkg/ddl/executor.go:3533— pkg/ddl/executor.go:3533-3540 | pkg/ddl/modify_column.go:2014-2021 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/executor.go:3533` 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) pkg/ddl/executor.go:3732— pkg/ddl/executor.go:3732-3740 | pkg/ddl/executor.go:4181-4188 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3732` 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 (8 lines × 2) pkg/ddl/executor.go:4353— pkg/ddl/executor.go:4353-4360 | pkg/ddl/executor.go:5571-5578 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:4353` 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) pkg/ddl/executor.go:4827— pkg/ddl/executor.go:4827-4834 | pkg/ddl/executor.go:5135-5142 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:4827` 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 (8 lines × 2) pkg/ddl/executor.go:5791— pkg/ddl/executor.go:5791-5798 | pkg/ddl/executor.go:5942-5949 — both copies are in the same file, so extract the 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 (8 lines × 2) pkg/ddl/index.go:3239— pkg/ddl/index.go:3239-3246 | pkg/ddl/index.go:3293-3300 — both copies are in the same file, so extract the 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 `pkg/ddl/index.go:3239` 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 (8 lines × 2) pkg/ddl/partition.go:2894— pkg/ddl/partition.go:2894-2901 | pkg/ddl/partition.go:2938-2947 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:2894` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/distsql/request_builder.go:663— pkg/distsql/request_builder.go:663-670 | pkg/distsql/request_builder.go:704-711 — both copies are in the same file, so extract the 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 `pkg/distsql/request_builder.go:663` 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 (8 lines × 2) pkg/domain/crossks/cross_ks.go:231— pkg/domain/crossks/cross_ks.go:231-238 | pkg/domain/domain.go:631-638 — 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 `pkg/domain/crossks/cross_ks.go:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/domain/infosync/info.go:905— pkg/domain/infosync/info.go:905-912 | pkg/domain/infosync/info.go:964-971 — both copies are in the same file, so extract the 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 `pkg/domain/infosync/info.go:905` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/dxf/importinto/collect_conflicts.go:119— pkg/dxf/importinto/collect_conflicts.go:119-126 | pkg/dxf/importinto/conflict_resolution.go:94-101 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once.
Duplicated block (8 lines × 2) pkg/dxf/importinto/task_executor.go:496— pkg/dxf/importinto/task_executor.go:496-503 | pkg/dxf/importinto/task_executor.go:718-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/dxf/importinto/task_executor.go:496` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) br/pkg/restore/snap_client/client.go:1221— br/pkg/restore/snap_client/client.go:1221-1231 | br/pkg/restore/snap_client/client.go:1431-1441 — both copies are in the same file, so extract the 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 `br/pkg/restore/snap_client/client.go: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.
Duplicated block (11 lines × 2) br/pkg/restore/snap_client/import.go:842— br/pkg/restore/snap_client/import.go:842-852 | br/pkg/restore/snap_client/import.go:966-976 — both copies are in the same file, so extract the 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 `br/pkg/restore/snap_client/import.go:842` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (11 lines × 2) br/pkg/restore/utils/rewrite_rule.go:202— br/pkg/restore/utils/rewrite_rule.go:202-212 | br/pkg/restore/utils/rewrite_rule.go:242-252 — both copies are in the same file, so extract the 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 `br/pkg/restore/utils/rewrite_rule.go:202` 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) br/pkg/task/operator/checksum_table.go:336— br/pkg/task/operator/checksum_table.go:336-346 | br/pkg/task/operator/checksum_table.go:415-425 — both copies are in the same file, so extract the 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 `br/pkg/task/operator/checksum_table.go:336` 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 (11 lines × 2) br/pkg/task/stream.go:875— br/pkg/task/stream.go:875-885 | br/pkg/task/stream.go:949-959 — both copies are in the same file, so extract the 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (11 lines × 2) lightning/pkg/checkpoints/checkpoints.go:637— lightning/pkg/checkpoints/checkpoints.go:637-647 | lightning/pkg/checkpoints/checkpoints.go:675-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lightning/pkg/checkpoints/checkpoints.go:637` 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) lightning/pkg/errormanager/errormanager.go:669— lightning/pkg/errormanager/errormanager.go:669-679 | lightning/pkg/errormanager/errormanager.go:875-885 — both copies are in the same file, so extract the 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 `lightning/pkg/errormanager/errormanager.go:669` 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) lightning/pkg/server/checkpoint_control.go:154— lightning/pkg/server/checkpoint_control.go:154-164 | lightning/pkg/server/checkpoint_control.go:275-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lightning/pkg/server/checkpoint_control.go:154` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (11 lines × 2) pkg/ddl/backfilling_operators.go:115— pkg/ddl/backfilling_operators.go:115-125 | pkg/ddl/backfilling_operators.go:173-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/backfilling_operators.go:115` 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) pkg/ddl/backfilling_operators.go:374— pkg/ddl/backfilling_operators.go:374-384 | pkg/ddl/backfilling_operators.go:1111-1121 — both copies are in the same file, so extract the 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 `pkg/ddl/backfilling_operators.go:374` 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 (11 lines × 2) pkg/ddl/executor.go:3206— pkg/ddl/executor.go:3206-3216 | pkg/ddl/executor.go:7655-7665 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3206` 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) pkg/ddl/executor.go:3508— pkg/ddl/executor.go:3508-3518 | pkg/ddl/schematracker/dm_tracker.go:592-602 — 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 `pkg/ddl/executor.go:3508` 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) pkg/ddl/executor.go:3756— pkg/ddl/executor.go:3756-3766 | pkg/ddl/executor.go:6180-6190 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:3756` 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) pkg/ddl/executor.go:6242— pkg/ddl/executor.go:6242-6252 | pkg/ddl/executor.go:6315-6325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/ddl/modify_column.go:593— pkg/ddl/modify_column.go:593-604 | pkg/ddl/modify_column.go:660-670 — both copies are in the same file, so extract the 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 `pkg/ddl/modify_column.go:593` 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) pkg/ddl/partition.go:4142— pkg/ddl/partition.go:4142-4152 | pkg/ddl/partition.go:4216-4226 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:4142` 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) br/pkg/metautil/debug.go:105— br/pkg/metautil/debug.go:105-116 | br/pkg/metautil/metafile.go:313-324 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/metautil/debug.go:105` 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 (12 lines × 2) br/pkg/restore/internal/prealloc_db/db.go:282— br/pkg/restore/internal/prealloc_db/db.go:282-293 | br/pkg/restore/internal/prealloc_db/db.go:320-332 — both copies are in the same file, so extract the 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 `br/pkg/restore/internal/prealloc_db/db.go:282` 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 (12 lines × 2) br/pkg/restore/log_client/client.go:1829— br/pkg/restore/log_client/client.go:1829-1840 | br/pkg/restore/log_client/log_split_strategy.go:83-95 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/log_client/client.go:1829` 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) br/pkg/stream/crr/internal/checkpoint/storage.go:188— br/pkg/stream/crr/internal/checkpoint/storage.go:188-199 | br/pkg/utiltest/crr/harness.go:145-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) br/pkg/stream/rewrite_meta_rawkv.go:213— br/pkg/stream/rewrite_meta_rawkv.go:213-224 | br/pkg/stream/rewrite_meta_rawkv.go:395-409 — both copies are in the same file, so extract the 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 `br/pkg/stream/rewrite_meta_rawkv.go:213` 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) br/pkg/stream/rewrite_meta_rawkv.go:257— br/pkg/stream/rewrite_meta_rawkv.go:257-268 | br/pkg/stream/rewrite_meta_rawkv.go:304-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) br/pkg/task/backup.go:519— br/pkg/task/backup.go:519-530 | br/pkg/task/restore.go:1717-1731 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup.go:519` 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) br/pkg/task/backup_raw.go:148— br/pkg/task/backup_raw.go:148-159 | br/pkg/task/backup_txn.go:128-139 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup_raw.go:148` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12 lines × 2) lightning/pkg/importer/precheck_impl.go:669— lightning/pkg/importer/precheck_impl.go:669-680 | lightning/pkg/importer/precheck_impl.go:943-954 — both copies are in the same file, so extract the 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 `lightning/pkg/importer/precheck_impl.go:669` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) pkg/bindinfo/binding_operator.go:165— pkg/bindinfo/binding_operator.go:165-178 | pkg/bindinfo/binding_operator.go:222-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/bindinfo/binding_operator.go:165` 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 (12 lines × 2) pkg/ddl/backfilling_dist_scheduler.go:531— pkg/ddl/backfilling_dist_scheduler.go:531-542 | pkg/ddl/backfilling_dist_scheduler.go:741-752 — both copies are in the same file, so extract the 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 `pkg/ddl/backfilling_dist_scheduler.go:531` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) pkg/ddl/executor.go:7127— pkg/ddl/executor.go:7127-7138 | pkg/ddl/executor.go:7163-7174 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:7127` 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) pkg/ddl/modify_column.go:1045— pkg/ddl/modify_column.go:1045-1056 | pkg/ddl/modify_column.go:1256-1267 — both copies are in the same file, so extract the 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 `pkg/ddl/modify_column.go:1045` 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) pkg/ddl/schematracker/dm_tracker.go:767— pkg/ddl/schematracker/dm_tracker.go:767-778 | pkg/ddl/schematracker/dm_tracker.go:793-804 — both copies are in the same file, so extract the 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) pkg/dxf/importinto/planner.go:766— pkg/dxf/importinto/planner.go:766-777 | pkg/dxf/importinto/planner.go:796-807 — both copies are in the same file, so extract the 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 `pkg/dxf/importinto/planner.go:766` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Hotspot: br/pkg/task/restore.go br/pkg/task/restore.go— br/pkg/task/restore.go changed 16 times in last 90 days, max complexity 126. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/ddl/executor.go pkg/ddl/executor.go— pkg/ddl/executor.go changed 11 times in last 90 days, max complexity 117. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/session/session.go pkg/session/session.go— pkg/session/session.go changed 17 times in last 90 days, max complexity 64. 1 of those changes was a fix/bug commit, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, 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.
Hotspot: pkg/config/config.go pkg/config/config.go— pkg/config/config.go changed 14 times in last 90 days, max complexity 74. 1 of those changes was a fix/bug commit, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, 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.
Hotspot: pkg/expression/distsql_builtin.go pkg/expression/distsql_builtin.go— pkg/expression/distsql_builtin.go changed 2 times in last 90 days, max complexity 515. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, 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.
Hotspot: pkg/executor/simple.go pkg/executor/simple.go— pkg/executor/simple.go changed 7 times in last 90 days, max complexity 141. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/planner/core/planbuilder.go pkg/planner/core/planbuilder.go— pkg/planner/core/planbuilder.go changed 10 times in last 90 days, max complexity 94. 1 of those changes was a fix/bug commit, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, 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.
Hotspot: br/pkg/task/stream.go br/pkg/task/stream.go— br/pkg/task/stream.go changed 13 times in last 90 days, max complexity 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/parser/ast/ddl.go pkg/parser/ast/ddl.go— pkg/parser/ast/ddl.go changed 3 times in last 90 days, max complexity 197. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/ddl/index.go pkg/ddl/index.go— pkg/ddl/index.go changed 13 times in last 90 days, max complexity 44. 2 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, 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.
Change coupling: logical_initialize.go ↔ property_cols_prune.go pkg/planner/core/logical_initialize.go— `pkg/planner/core/logical_initialize.go` and `pkg/planner/core/property_cols_prune.go` change together 85% of the time (11 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Change coupling: errcode.go ↔ errcode.go pkg/errno/errcode.go— `pkg/errno/errcode.go` and `pkg/parser/mysql/errcode.go` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) 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.
Change coupling: logical_initialize.go ↔ stats.go pkg/planner/core/logical_initialize.go— `pkg/planner/core/logical_initialize.go` and `pkg/planner/core/stats.go` change together 77% of the time (20 of the 26 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Change coupling: property_cols_prune.go ↔ stats.go pkg/planner/core/property_cols_prune.go— `pkg/planner/core/property_cols_prune.go` and `pkg/planner/core/stats.go` change together 77% of the time (10 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Change coupling: exhaust_physical_plans.go ↔ rule_topn_push_down.go pkg/planner/core/exhaust_physical_plans.go— `pkg/planner/core/exhaust_physical_plans.go` and `pkg/planner/core/rule_topn_push_down.go` change together 76% of the time (13 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Change coupling: rule_inject_extra_projection.go ↔ task.go pkg/planner/core/rule_inject_extra_projection.go— `pkg/planner/core/rule_inject_extra_projection.go` and `pkg/planner/core/task.go` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Change coupling: pattern.go ↔ core_init.go pkg/planner/cascades/pattern/pattern.go— `pkg/planner/cascades/pattern/pattern.go` and `pkg/planner/core/core_init.go` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) 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.
Change coupling: pattern.go ↔ func_pointer_misc.go pkg/planner/cascades/pattern/pattern.go— `pkg/planner/cascades/pattern/pattern.go` and `pkg/planner/util/utilfuncp/func_pointer_misc.go` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) 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.
Change coupling: stringer.go ↔ func_pointer_misc.go pkg/planner/core/stringer.go— `pkg/planner/core/stringer.go` and `pkg/planner/util/utilfuncp/func_pointer_misc.go` change together 74% of the time (23 of the 31 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) 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.
Change coupling: core_init.go ↔ stringer.go pkg/planner/core/core_init.go— `pkg/planner/core/core_init.go` and `pkg/planner/core/stringer.go` change together 74% of the time (23 of the 31 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking.
Duplicated block (14 lines × 2) br/pkg/task/backup_raw.go:175— br/pkg/task/backup_raw.go:175-188 | br/pkg/task/backup_txn.go:162-175 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup_raw.go:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (14 lines × 2) br/pkg/task/backup_raw.go:246— br/pkg/task/backup_raw.go:246-260 | br/pkg/task/backup_txn.go:231-244 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup_raw.go:246` 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) lightning/pkg/errormanager/errormanager.go:532— lightning/pkg/errormanager/errormanager.go:532-547 | lightning/pkg/errormanager/errormanager.go:733-746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `lightning/pkg/errormanager/errormanager.go:532` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pkg/ddl/backfilling_dist_scheduler.go:365— pkg/ddl/backfilling_dist_scheduler.go:365-378 | pkg/ddl/backfilling_dist_scheduler.go:914-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 `pkg/ddl/backfilling_dist_scheduler.go: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 (14 lines × 2) pkg/ddl/backfilling_dist_scheduler.go:417— pkg/ddl/backfilling_dist_scheduler.go:417-430 | pkg/ddl/backfilling_dist_scheduler.go:962-975 — both copies are in the same file, so extract the 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 `pkg/ddl/backfilling_dist_scheduler.go:417` 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) pkg/ddl/cluster.go:468— pkg/ddl/cluster.go:468-481 | pkg/ddl/cluster.go:562-575 — both copies are in the same file, so extract the 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 `pkg/ddl/cluster.go:468` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pkg/ddl/column.go:725— pkg/ddl/column.go:725-738 | pkg/ddl/partition.go:4065-4078 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/column.go:725` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pkg/ddl/ddl_running_jobs.go:208— pkg/ddl/ddl_running_jobs.go:208-221 | pkg/ddl/ddl_running_jobs.go:259-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/ddl_running_jobs.go:208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pkg/ddl/partition.go:1573— pkg/ddl/partition.go:1573-1586 | pkg/ddl/partition.go:1668-1682 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:1573` 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) pkg/ddl/executor.go:1809— pkg/ddl/executor.go:1809-1814 | pkg/ddl/schematracker/dm_tracker.go:929-934 — 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 `pkg/ddl/executor.go:1809` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) pkg/ddl/partition.go:2216— pkg/ddl/partition.go:2216-2221 | pkg/ddl/partition.go:2342-2348 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:2216` 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) pkg/domain/infosync/info.go:1276— pkg/domain/infosync/info.go:1276-1281 | pkg/domain/infosync/info.go:1340-1345 — both copies are in the same file, so extract the 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.
Duplicated block (6 lines × 2) pkg/domain/plan_replayer_dump.go:250— pkg/domain/plan_replayer_dump.go:250-255 | pkg/domain/plan_replayer_dump.go:263-268 — both copies are in the same file, so extract the 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 `pkg/domain/plan_replayer_dump.go:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) pkg/domain/serverinfo/syncer.go:126— pkg/domain/serverinfo/syncer.go:126-131 | pkg/domain/serverinfo/syncer.go:177-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.
Duplicated block (6 lines × 2) pkg/dxf/framework/scheduler/scheduler.go:293— pkg/dxf/framework/scheduler/scheduler.go:293-298 | pkg/dxf/framework/scheduler/scheduler.go:379-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) pkg/dxf/framework/scheduler/scheduler.go:355— pkg/dxf/framework/scheduler/scheduler.go:355-360 | pkg/dxf/framework/scheduler/scheduler.go:436-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/dxf/framework/scheduler/scheduler.go:355` 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) pkg/dxf/framework/taskexecutor/task_executor.go:704— pkg/dxf/framework/taskexecutor/task_executor.go:704-709 | pkg/dxf/framework/taskexecutor/task_executor.go:745-750 — both copies are in the same file, so extract the 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 `pkg/dxf/framework/taskexecutor/task_executor.go:704` 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.
D38 · OSV Dependency Vulnerabilities· Medium CVE · ×7
Medium CVE: GO-2026-4503 go.mod— filippo.io/edwards25519 1.1.0 (filippo.io/edwards25519): GO-2026-4503 — filippo.io/edwards25519 is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get filippo.io/edwards25519@v1.1.1`, which updates the require line go.mod already holds for it).
Medium CVE: GO-2022-0635 go.mod— github.com/aws/aws-sdk-go 1.55.7 (github.com/aws/aws-sdk-go/service/s3/s3crypto): GO-2022-0635 — no fixed version has been published yet. Track the advisory; github.com/aws/aws-sdk-go is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so the action is on the dependency that requires it — upgrade or replace that dependent. Before doing either, check whether any affected package above is actually linked here: `go list -deps ./... | grep -F -e github.com/aws/aws-sdk-go/service/s3/s3crypto` lists it whether your own code imports it or a dependency pulls it in — a module can be in the build list for one sub-package while the vulnerable one is never reached, in which case there is nothing to remove and tracking the advisory is the whole action. This one row stands for the 2 advisories this scan raises against github.com/aws/aws-sdk-go 1.55.7: GO-2022-0635, GO-2022-0646.
Medium CVE: GO-2026-5736 go.mod— go.etcd.io/etcd/server/v3 3.5.15 (go.etcd.io/etcd/server/v3/etcdserver): GO-2026-5736 — upgrade to 3.5.30
Medium CVE: GO-2026-5158 go.mod— go.opentelemetry.io/otel 1.43.0 (go.opentelemetry.io/otel/baggage, go.opentelemetry.io/otel/propagation): GO-2026-5158 — go.opentelemetry.io/otel is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get go.opentelemetry.io/otel@v1.44.0`, which updates the require line go.mod already holds for it).
Medium CVE: GO-2026-5942 go.mod— golang.org/x/net 0.55.0 (golang.org/x/net/dns/dnsmessage): GO-2026-5942 — upgrade to 0.56.0
Medium CVE: GO-2026-5970 pkg/parser/go.mod— golang.org/x/text 0.19.0 (golang.org/x/text/unicode/norm): GO-2026-5970 — upgrade to 0.39.0
Medium CVE: GO-2026-5970 go.mod— golang.org/x/text 0.37.0 (golang.org/x/text/unicode/norm): GO-2026-5970 — upgrade to 0.39.0
Duplicated block (5 lines × 2) br/pkg/restore/log_client/client.go:2567— br/pkg/restore/log_client/client.go:2567-2571 | br/pkg/restore/log_client/client.go:2662-2666 — both copies are in the same file, so extract the 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 `br/pkg/restore/log_client/client.go:2567` 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) pkg/ddl/executor.go:3416— pkg/ddl/executor.go:3416-3420 | pkg/ddl/schematracker/dm_tracker.go:676-680 — 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 `pkg/ddl/executor.go:3416` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) pkg/ddl/executor.go:3561— pkg/ddl/executor.go:3561-3565 | pkg/ddl/schematracker/dm_tracker.go:664-668 — 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 `pkg/ddl/executor.go:3561` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) pkg/ddl/executor.go:4545— pkg/ddl/executor.go:4545-4549 | pkg/ddl/executor.go:4598-4602 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:4545` 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 (5 lines × 2) pkg/ddl/executor.go:5807— pkg/ddl/executor.go:5807-5811 | pkg/ddl/executor.go:5960-5964 — both copies are in the same file, so extract the 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.
Duplicated block (5 lines × 2) pkg/ddl/index.go:4030— pkg/ddl/index.go:4030-4034 | pkg/ddl/index.go:4047-4051 — both copies are in the same file, so extract the 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 `pkg/ddl/index.go:4030` 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) pkg/ddl/partition.go:4161— pkg/ddl/partition.go:4161-4165 | pkg/ddl/partition.go:4236-4240 — both copies are in the same file, so extract the 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 `pkg/ddl/partition.go:4161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) br/pkg/task/backup_raw.go:104— br/pkg/task/backup_raw.go:104-116 | br/pkg/task/backup_txn.go:76-88 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup_raw.go:104` 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 (13 lines × 2) dumpling/export/dump.go:1087— dumpling/export/dump.go:1087-1099 | dumpling/export/dump.go:1129-1141 — both copies are in the same file, so extract the 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 `dumpling/export/dump.go:1087` 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) dumpling/export/writer_util.go:427— dumpling/export/writer_util.go:427-439 | dumpling/export/writer_util.go:706-718 — both copies are in the same file, so extract the 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 `dumpling/export/writer_util.go:427` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pkg/ddl/executor.go:2597— pkg/ddl/executor.go:2597-2609 | pkg/ddl/executor.go:2671-2683 — both copies are in the same file, so extract the 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 `pkg/ddl/executor.go:2597` 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) pkg/ddl/index.go:896— pkg/ddl/index.go:896-908 | pkg/ddl/index.go:1165-1177 — both copies are in the same file, so extract the 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 `pkg/ddl/index.go:896` 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 (13 lines × 2) pkg/ddl/table.go:1588— pkg/ddl/table.go:1588-1600 | pkg/ddl/table.go:1636-1648 — both copies are in the same file, so extract the 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 `pkg/ddl/table.go:1588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) br/pkg/restore/internal/prealloc_db/db.go:189— br/pkg/restore/internal/prealloc_db/db.go:189-195 | br/pkg/restore/internal/prealloc_db/db.go:199-205 | br/pkg/restore/internal/prealloc_db/db.go:254-260 — 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 `br/pkg/restore/internal/prealloc_db/db.go:189` 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 × 3) br/pkg/restore/split/split.go:194— br/pkg/restore/split/split.go:194-200 | br/pkg/restore/split/split.go:378-385 | br/pkg/streamhelper/regioniter.go:105-111 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/split/split.go:194` 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 (7 lines × 3) br/pkg/restore/tiflashrec/tiflash_recorder.go:108— br/pkg/restore/tiflashrec/tiflash_recorder.go:108-114 | br/pkg/restore/tiflashrec/tiflash_recorder.go:118-124 | br/pkg/restore/tiflashrec/tiflash_recorder.go:145-151 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/restore/tiflashrec/tiflash_recorder.go:108` 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 × 3) pkg/ddl/executor.go:2287— pkg/ddl/executor.go:2287-2293 | pkg/ddl/executor.go:2839-2845 | pkg/ddl/executor.go:2911-2917 — 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 `pkg/ddl/executor.go:2287` 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 (7 lines × 3) pkg/ddl/executor.go:5524— pkg/ddl/executor.go:5524-5530 | pkg/ddl/executor.go:7118-7124 | pkg/ddl/executor.go:7154-7160 — 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 `pkg/ddl/executor.go:5524` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) br/pkg/backup/store.go:132— br/pkg/backup/store.go:132-142 | br/pkg/task/backup.go:692-703 | br/pkg/utils/store_manager.go:140-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/backup/store.go:132` 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 (11 lines × 3) lightning/pkg/errormanager/errormanager.go:623— lightning/pkg/errormanager/errormanager.go:623-633 | lightning/pkg/errormanager/errormanager.go:803-813 | lightning/pkg/errormanager/errormanager.go:832-842 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) pkg/ddl/executor.go:2336— pkg/ddl/executor.go:2336-2347 | pkg/ddl/executor.go:2582-2592 | pkg/ddl/executor.go:2655-2666 — 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 `pkg/ddl/executor.go:2336` 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 × 3) pkg/dxf/importinto/planner.go:825— pkg/dxf/importinto/planner.go:825-835 | pkg/dxf/importinto/planner.go:846-856 | pkg/dxf/importinto/planner.go:862-872 — 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 `pkg/dxf/importinto/planner.go:825` 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 (16 lines × 2) lightning/pkg/checkpoints/checkpoints.go:2016— lightning/pkg/checkpoints/checkpoints.go:2016-2031 | lightning/pkg/checkpoints/checkpoints.go:2039-2054 — both copies are in the same file, so extract the 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 `lightning/pkg/checkpoints/checkpoints.go:2016` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) lightning/pkg/errormanager/errormanager.go:717— lightning/pkg/errormanager/errormanager.go:717-732 | lightning/pkg/errormanager/errormanager.go:895-910 — both copies are in the same file, so extract the 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 `lightning/pkg/errormanager/errormanager.go:717` 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 (16 lines × 2) pkg/ddl/backfilling_operators.go:1271— pkg/ddl/backfilling_operators.go:1271-1286 | pkg/ddl/index_merge_tmp.go:207-222 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/ddl/backfilling_operators.go:1271` 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 × 4) br/pkg/metautil/debug.go:50— br/pkg/metautil/debug.go:50-58 | br/pkg/metautil/debug.go:93-103 | br/pkg/metautil/metafile.go:301-311 | br/pkg/metautil/statsfile.go:200-210 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9 lines × 4) br/pkg/task/stream.go:630— br/pkg/task/stream.go:630-638 | br/pkg/task/stream.go:816-824 | br/pkg/task/stream.go:875-883 | br/pkg/task/stream.go:949-957 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (9 lines × 4) pkg/ddl/executor.go:6581— pkg/ddl/executor.go:6581-6589 | pkg/ddl/executor.go:6627-6635 | pkg/ddl/executor.go:6666-6675 | pkg/ddl/executor.go:6719-6727 — 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 `pkg/ddl/executor.go:6581` 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.
indentFormatter.format (cyclomatic 23) pkg/util/format/format.go:86— indentFormatter.format has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
indentFormatter.format (cyclomatic 23) pkg/parser/format/format.go:86— indentFormatter.format has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
main.main (cyclomatic 17) cmd/importer/main.go:26— main.main has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.main (cyclomatic 17) cmd/pluginpkg/pluginpkg.go:91— main.main has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
indentFormatter.format (cognitive 44) pkg/util/format/format.go:86— indentFormatter.format has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16, match/switch 15, loops 11, boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
indentFormatter.format (cognitive 44) pkg/parser/format/format.go:86— indentFormatter.format has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16, match/switch 15, loops 11, boolean chains 2 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MyDecimal.ToString (cognitive 22) pkg/types/mydecimal.go:328— MyDecimal.ToString has cognitive complexity 22 (threshold 15). Drivers by points: loops 13, if/else 9 (nesting depth added 7). 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.
MyDecimal.ToString (cognitive 22) pkg/parser/test_driver/test_driver_mydecimal.go:108— MyDecimal.ToString has cognitive complexity 22 (threshold 15). Drivers by points: loops 13, if/else 9 (nesting depth added 7). 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.
Duplicated block (15 lines × 2) br/pkg/task/backup_raw.go:189— br/pkg/task/backup_raw.go:189-203 | br/pkg/task/backup_txn.go:176-190 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `br/pkg/task/backup_raw.go:189` 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) pkg/autoid_service/autoid.go:90— pkg/autoid_service/autoid.go:90-104 | pkg/autoid_service/autoid.go:165-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 lines × 3) pkg/ddl/column.go:879— pkg/ddl/column.go:879-888 | pkg/ddl/index.go:2865-2874 | pkg/ddl/index.go:3791-3800 — 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 `pkg/ddl/column.go:879` 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 × 3) pkg/domain/plan_replayer_dump.go:695— pkg/domain/plan_replayer_dump.go:695-704 | pkg/domain/plan_replayer_dump.go:719-728 | pkg/domain/plan_replayer_dump.go:745-754 — 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 `pkg/domain/plan_replayer_dump.go:695` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 3) br/pkg/task/operator/checksum_table.go:65— br/pkg/task/operator/checksum_table.go:65-75 | br/pkg/task/operator/checksum_table.go:92-100 | br/pkg/task/operator/checksum_table.go:527-535 — 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 `br/pkg/task/operator/checksum_table.go:65` 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 × 3) dumpling/export/writer_util.go:199— dumpling/export/writer_util.go:199-207 | dumpling/export/writer_util.go:370-378 | dumpling/export/writer_util.go:666-674 — 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 `dumpling/export/writer_util.go:199` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 3) pkg/ddl/executor.go:5375— pkg/ddl/executor.go:5375-5382 | pkg/ddl/executor.go:5456-5463 | pkg/ddl/executor.go:6115-6123 — 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 `pkg/ddl/executor.go:5375` 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 × 3) pkg/ddl/index.go:3786— pkg/ddl/index.go:3786-3793 | pkg/ddl/index_merge_tmp.go:188-195 | pkg/ddl/partition.go:3901-3908 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once.
AlterTableSpec.Restore (cyclomatic 197) pkg/parser/ast/ddl.go:3616— AlterTableSpec.Restore has cyclomatic complexity 197 (threshold 15). Of this number, 194 points are the body's own statements and 3 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.
SimpleExec.executeAlterUser (cyclomatic 141) pkg/executor/simple.go:1731— SimpleExec.executeAlterUser has cyclomatic complexity 141 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
executor.constructResultOfShowCreateTable (cyclomatic 132) pkg/executor/show.go:1052— executor.constructResultOfShowCreateTable has cyclomatic complexity 132 (threshold 15). Of this number, 130 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ShowStmt.Restore (cyclomatic 129) pkg/parser/ast/dml.go:3296— ShowStmt.Restore has cyclomatic complexity 129 (threshold 15). Of this number, 121 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.
task.runSnapshotRestore (cyclomatic 126) br/pkg/task/restore.go:1303— task.runSnapshotRestore has cyclomatic complexity 126 (threshold 15). Of this number, 99 points are the body's own statements and 27 belong to 8 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.
executor.getStmtDbLabel (cyclomatic 119) pkg/executor/compiler.go:234— executor.getStmtDbLabel has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
executor.AlterTable (cyclomatic 117) pkg/ddl/executor.go:1707— executor.AlterTable has cyclomatic complexity 117 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Plan.initOptions (cyclomatic 102) pkg/executor/importer/import.go:767— Plan.initOptions has cyclomatic complexity 102 (threshold 15). Of this number, 95 points are the body's own statements and 7 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.
core.findBestTask4LogicalDataSource (cyclomatic 96) pkg/planner/core/find_best_task.go:2009— core.findBestTask4LogicalDataSource has cyclomatic complexity 96 (threshold 15). Of this number, 84 points are the body's own statements and 12 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.
worker.runOneJobStep (cyclomatic 94) pkg/ddl/job_worker.go:837— worker.runOneJobStep has cyclomatic complexity 94 (threshold 15). Of this number, 86 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
PlanBuilder.buildDDL (cyclomatic 94) pkg/planner/core/planbuilder.go:5300— PlanBuilder.buildDDL has cyclomatic complexity 94 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.toString (cyclomatic 90) pkg/planner/core/stringer.go:86— core.toString has cyclomatic complexity 90 (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.
worker.onReorganizePartition (cyclomatic 88) pkg/ddl/partition.go:3234— worker.onReorganizePartition has cyclomatic complexity 88 (threshold 15). Of this number, 78 points are the body's own statements and 10 belong to 10 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.
addSubDateFunctionClass.getFunction (cyclomatic 88) pkg/expression/builtin_time.go:3755— addSubDateFunctionClass.getFunction has cyclomatic complexity 88 (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.
TableOption.Restore (cyclomatic 88) pkg/parser/ast/ddl.go:2889— TableOption.Restore has cyclomatic complexity 88 (threshold 15). Of this number, 86 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
PlanBuilder.buildSelect (cyclomatic 87) pkg/planner/core/logical_plan_builder.go:4260— PlanBuilder.buildSelect has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RPCClient.SendRequest (cyclomatic 86) pkg/store/mockstore/unistore/rpc.go:76— RPCClient.SendRequest has cyclomatic complexity 86 (threshold 15). Of this number, 54 points are the body's own statements and 32 belong to 19 function literals inside it that branch. 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.
PlanBuilder.buildDataSource (cyclomatic 82) pkg/planner/core/logical_plan_builder.go:4930— PlanBuilder.buildDataSource has cyclomatic complexity 82 (threshold 15). Of this number, 80 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.create (cyclomatic 80) pkg/table/tables/index.go:301— index.create 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.
SimpleExec.executeCreateUser (cyclomatic 79) pkg/executor/simple.go:1049— SimpleExec.executeCreateUser has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.main1 (cyclomatic 78) pkg/parser/goyacc/main.go:244— main.main1 has cyclomatic complexity 78 (threshold 15). Of this number, 67 points are the body's own statements and 11 belong to 5 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.
Config.ParseFromFlags (cyclomatic 76) dumpling/export/config.go:417— Config.ParseFromFlags has cyclomatic complexity 76 (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.
cardinality.Selectivity (cyclomatic 76) pkg/planner/cardinality/selectivity.go:51— cardinality.Selectivity has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
preprocessor.Enter (cyclomatic 75) pkg/planner/core/preprocess.go:259— preprocessor.Enter has cyclomatic complexity 75 (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.
DecorrelateSolver.optimize (cyclomatic 75) pkg/planner/core/rule_decorrelate.go:215— DecorrelateSolver.optimize has cyclomatic complexity 75 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.